diff --git a/calendar_fetcher.py b/calendar_fetcher.py index 1c8b1b9..cf0e9d4 100755 --- a/calendar_fetcher.py +++ b/calendar_fetcher.py @@ -98,13 +98,13 @@ def fetch_calendar(): for eventraw in results: eventUuid = str(eventraw).split("/")[-1].split(".")[0] - #print(" - %s" % eventUuid) + #print(" - %s" % eventUuid) - #print(str(eventraw)) + # print(str(eventraw)) #event = icalendar.Calendar.from_ical(eventraw._data) url = "https://" + cfg.userN + ":" + cfg.passW + "@" + str(eventraw).replace("Event: https://", "") - #print(url) + # print(url) data = requests.get(url).text event = icalendar.Calendar.from_ical(data) @@ -114,23 +114,23 @@ def fetch_calendar(): ##eventsList[day][eventUuid]["calendar"] = str(calendar).split("/")[-2] eventsList[day][eventUuid]["calendar"] = str(calendar) - #print(" summary: %s" % component.get('summary')) + # print(" summary: %s" % component.get('summary')) eventsList[day][eventUuid]["summary"] = str(component.get('summary')) - #print(" description: %s" % component.get('description')) + # print(" description: %s" % component.get('description')) #eventsList[day][eventUuid]["description"] = str(component.get('description')) startDate = component.get('dtstart') - #print(" dtstart: %s (%s)" % (startDate.dt.strftime('%m/%d/%Y %H:%M'), day)) + # print(" dtstart: %s == %s?" % (startDate.dt.strftime('%m/%d/%Y %H:%M'), day)) if startDate.dt.strftime('%m/%d/%Y') == day.strftime('%m/%d/%Y'): # event starts today - #print(" single day event") + # print(" single day event") eventsList[day][eventUuid]["startDate"] = startDate.dt.strftime('%m/%d/%Y') eventsList[day][eventUuid]["startTime"] = (startDate.dt + datetime.timedelta(hours=utcOffset)).strftime('%H:%M') else: # event started before today, set startdate to day and start time to midnight (for multi day events with start/end time) - #print(" multi day event") + # print(" multi day event") eventsList[day][eventUuid]["startDate"] = day.strftime('%m/%d/%Y') - eventsList[day][eventUuid]["startTime"] = "00:00" - + # eventsList[day][eventUuid]["startTime"] = "00:00" # No longer working! + eventsList[day][eventUuid]["startTime"] = (startDate.dt + datetime.timedelta(hours=utcOffset)).strftime('%H:%M') try: endDate = component.get('dtend') @@ -140,7 +140,8 @@ def fetch_calendar(): eventsList[day][eventUuid]["endTime"] = (endDate.dt + datetime.timedelta(hours=utcOffset)).strftime('%H:%M') else: # event ends after today, set enddate to day and end time to midnight (for multi day events with start/end time) eventsList[day][eventUuid]["endDate"] = day.strftime('%m/%d/%Y') - eventsList[day][eventUuid]["endTime"] = "24:00" + # eventsList[day][eventUuid]["endTime"] = "24:00" # No longer working! + eventsList[day][eventUuid]["endDate"] = endDate.dt.strftime('%m/%d/%Y') except AttributeError as ae: # event has no endtime, use duration #print(" %s" % ae)