aboutsummaryrefslogtreecommitdiff
path: root/scripts/lmu_ical.py
blob: c0965248a34a845b9c20d3fa7806091e0c1816c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python3
import icalendar
import sys

# Fix LMU LSF iCal files
# first arg is original file

e = open(sys.argv[1], 'rb')
cal = icalendar.Calendar.from_ical(e.read())
e.close()

for component in cal.walk():
   if component.name == "VEVENT":
       if 'exdate' in component and component['exdate'] is None:
           del component['exdate']

f = open('fixed.ics', 'wb')
f.write(cal.to_ical())
f.close()