Added fix for errors when email action was used

This commit is contained in:
Ace 2019-02-21 20:11:16 +01:00 committed by GitHub
parent b4a3a6a005
commit 21e9570575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -193,10 +193,11 @@ def main():
for icalendars in ical_urls:
decode = str(urlopen(icalendars).read().decode())
#fix a bug related to Alarm action by replacing parts of the icalendar
fix_e = decode.replace('BEGIN:VALARM\r\nACTION:NONE','BEGIN:VALARM\r\nACTION:DISPLAY\r\nDESCRIPTION:')
fix_e_1 = decode.replace('BEGIN:VALARM\r\nACTION:NONE','BEGIN:VALARM\r\nACTION:DISPLAY\r\nDESCRIPTION:')
fix_e_2 = fix_e_1.replace('BEGIN:VALARM\r\nACTION:EMAIL','BEGIN:VALARM\r\nACTION:DISPLAY\r\nDESCRIPTION:')
#uncomment line below to display your calendar in ical format
#print(fix_e)
ical = Calendar(fix_e)
#print(fix_e_2)
ical = Calendar(fix_e_2)
for events in ical.events:
if time.now().strftime('%-m %Y') == (events.begin).format('M YYYY') and (events.begin).format('DD') >= time.now().strftime('%d'):
upcoming.append({'date':events.begin.format('DD MMM'), 'event':events.name})