Added useful ics headers
This commit is contained in:
parent
99325d3876
commit
f76f646db7
1 changed files with 10 additions and 1 deletions
11
fp-ics
11
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)
|
||||
|
|
Loading…
Add table
Reference in a new issue