From 4cd352c4a6906d90e171e36d3027e803009e4af6 Mon Sep 17 00:00:00 2001 From: James French Date: Tue, 14 Jun 2011 18:51:40 +0800 Subject: [PATCH] Facebook Organiser Fix & iCal Workaround - iCal/iPhone don't like multiple EXDATES on one line, break them out into seperate entries - Changed where the organiser sits for facebook events that are group organised - Todo: specify rule lists - Ignored some files --- .gitignore | 2 ++ parserrules.py | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 843ff47..866dbd9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .httplib2-cache +.pydevproject +.project *.pyc diff --git a/parserrules.py b/parserrules.py index 973aa45..cf60f98 100644 --- a/parserrules.py +++ b/parserrules.py @@ -51,7 +51,9 @@ def whatPrivacy(cal): for event in cal.vevent_list: if event.contents.has_key(u'class'): - getattr(event, 'class').value = "PUBLIC" + # Bit of a hack as class is a reserved word in python + del event.contents[u'class'] + event.add('class').value = "PUBLIC" return cal @@ -160,3 +162,20 @@ def unwantedParams(cal): return cal +def exDate(cal): + '''Changes multi-EXDATE into singles (apple can't obey even simple specs)''' + + for event in cal.vevent_list: + if not event.contents.has_key(u'exdate'): continue + dates = event.exdate.value + try: tzid = event.exdate.tzid_param + except AttributeError: tzid = '' + + del event.contents[u'exdate'] + + for date in dates: + entry = event.add(u'exdate') + entry.value = [date] + if tzid: entry.tzid_param = tzid + + return cal -- 2.20.1