From f76f646db79d2d38f62b9c14316e92176c076e9d Mon Sep 17 00:00:00 2001 From: Leon Haag-Fank Date: Fri, 18 Oct 2024 21:48:19 +0200 Subject: [PATCH] Added useful ics headers --- fp-ics | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fp-ics b/fp-ics index 9272e2d..f1b4178 100755 --- a/fp-ics +++ b/fp-ics @@ -9,6 +9,7 @@ from zoneinfo import ZoneInfo URL = 'https://www.physi.uni-heidelberg.de/Einrichtungen/FP/seminar/seminar.php' SEMINAR_LENGTH = 45 #min +TZ = 'Europe/Berlin' def getcal(): @@ -16,6 +17,14 @@ def getcal(): soup = BeautifulSoup(page.content, 'lxml') cal = ical.Calendar() + cal.add('X-WR-CALNAME', 'FP Seminare') + cal.add('X-WR-CALDESC', 'Auto generated calendar for current FP seminars on {}.'.format(URL)) + cal.add('X-WR-TIMEZONE', TZ) + cal.add('X-PUBLISHED-TTL', 'P1D') + cal.add('URL', 'https://git.haagfank.de/LnLcFlx/fp-ics') + cal.add('CALSCALE', 'GREGORIAN') + cal.add('METHOD', 'PUBLISH') + for table in soup.find(id='content').find_all('table')[1:]: try: trs = table.find_all('tr') @@ -35,7 +44,7 @@ def getcal(): event = ical.Event() datum = datetime.strptime(tds[0].text.strip(), '%d.%m.%y').date() - start = datetime.combine(datum, zeit, tzinfo=ZoneInfo('Europe/Berlin')) + start = datetime.combine(datum, zeit, tzinfo=ZoneInfo(TZ)) event.add('dtstart', start) end = start+timedelta(minutes=SEMINAR_LENGTH) event.add('dtend', end)