summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/get_calendar.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/scripts/get_calendar.py b/scripts/get_calendar.py
index 20a8b6f..89daf07 100644
--- a/scripts/get_calendar.py
+++ b/scripts/get_calendar.py
@@ -11,9 +11,6 @@ import os
from dateutil.rrule import rrulestr
import icalendar
import subprocess
-import pytz
-
-berlin = pytz.timezone('Europe/Berlin')
def fetch_calendar(logger):
"""Fetches the calendar events and returns a icalendar.Calendar instance.
@@ -84,10 +81,6 @@ def get_events(calendar, after, before):
if end.hour == 0 and end.minute == 0 and end.second == 0:
end -= timedelta(seconds=1)
- if start.tzinfo is None:
- start = berlin.localize(start)
- if end.tzinfo is None:
- end = berlin.localize(end)
if 'rrule' in event:
rrule = rrulestr(event['rrule'].to_ical(), dtstart=start)
duration = end - start
@@ -138,15 +131,15 @@ if __name__ == '__main__':
logging.basicConfig(stream=sys.stderr, level=logging.ERROR)
logger = logging.getLogger('calendar_feed')
regen, calendar = fetch_calendar(logger)
- now = berlin.localize(datetime.now())
+ now = datetime.now()
after = now - relativedelta(days=1)
before = now + relativedelta(months=+1)
- after_tab = berlin.localize(datetime(now.year,now.month,1))
+ after_tab = datetime(now.year,now.month,1);
if now.month + 2 > 12:
- before_tab = berlin.localize(datetime(now.year+1,now.month + 10,1))
+ before_tab = datetime(now.year+1,now.month + 10,1)
else:
- before_tab = berlin.localize(datetime(now.year,now.month+2,1))
+ before_tab = datetime(now.year,now.month+2,1)
changed = put_events(calendar, after, before,
os.path.join(base_path, '../template/calendar.json'))