aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2023-10-15 13:20:12 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2023-10-15 13:20:12 +0200
commit7c17d6fa09d316a66bbfb05592ce5ba7a73c0cae (patch)
tree077490a738e8f61dccfbe18d49d5cfd078376566
parent782aaa658bb089b4ac7b7b3077d3a4c0678bf094 (diff)
downloaddotfiles-7c17d6fa09d316a66bbfb05592ce5ba7a73c0cae.tar.gz
lmu_ical script
-rwxr-xr-xscripts/lmu_ical.py19
1 files changed, 19 insertions, 0 deletions
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()