From 7c17d6fa09d316a66bbfb05592ce5ba7a73c0cae Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Sun, 15 Oct 2023 13:20:12 +0200 Subject: lmu_ical script --- scripts/lmu_ical.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 scripts/lmu_ical.py diff --git a/scripts/lmu_ical.py b/scripts/lmu_ical.py new file mode 100755 index 0000000..c096524 --- /dev/null +++ b/scripts/lmu_ical.py @@ -0,0 +1,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() -- cgit v1.2.3