Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add asymmetric windowing #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions ical2org.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

# Change here your local timezone
LOCAL_TZ = timezone("Europe/Paris")
# Window lenght in days (left & right from current time). Has to be possitive.
WINDOW = 90
# Window length in days (left & right from current time). Has to be positive.
LEFT_WINDOW = 30 # into the past
RIGHT_WINDOW = 90 # into the future
# leave empty if you don't want to attach any tag to recurring events
RECUR_TAG = ":RECURRING:"

Expand Down Expand Up @@ -196,8 +197,8 @@ def next(self):
cal = Calendar.from_ical(fh.read())

now = datetime.now(utc)
start = now - timedelta( days = WINDOW)
end = now + timedelta( days = WINDOW)
start = now - timedelta( days = LEFT_WINDOW)
end = now + timedelta( days = RIGHT_WINDOW)
for comp in cal.walk():
try:
event_iter = generate_event_iterator(comp, start, end)
Expand Down