|
|
|
@ -7,15 +7,25 @@ from urllib.request import urlopen
|
|
|
|
|
from zoneinfo import ZoneInfo
|
|
|
|
|
|
|
|
|
|
GRANULARITY = 30
|
|
|
|
|
ROOM_SEQUENCE = ('Sondermaschinenbau', 'Smart City Schmiede', 'Sofaecke', 'CTF')
|
|
|
|
|
ROOM_SEQUENCE = ('Sondermaschinenbau', 'Smart City Schmiede', 'Sofaecke', 'Außenbereich', 'Rennstrecke', 'Cyberspace')
|
|
|
|
|
SCHEDULE_URL = 'https://cfp.fairydust.reisen/iger-2022/schedule/export/schedule.json'
|
|
|
|
|
TIMEZONE = 'Europe/Berlin'
|
|
|
|
|
|
|
|
|
|
def parse_duration(s, num_parts):
|
|
|
|
|
def parse_duration(s):
|
|
|
|
|
duration = 0
|
|
|
|
|
for t in s.split(':', maxsplit=num_parts-1):
|
|
|
|
|
components = s.split(':')
|
|
|
|
|
|
|
|
|
|
if len(components) == 3:
|
|
|
|
|
duration += int(components[0])
|
|
|
|
|
duration *= 24
|
|
|
|
|
components = components[1:]
|
|
|
|
|
|
|
|
|
|
if len(components) == 2:
|
|
|
|
|
duration += int(components[0])
|
|
|
|
|
duration *= 60
|
|
|
|
|
duration += int(t)
|
|
|
|
|
duration += int(components[1])
|
|
|
|
|
else:
|
|
|
|
|
raise RuntimeError(f'invalid duration format: {s}')
|
|
|
|
|
|
|
|
|
|
return duration
|
|
|
|
|
|
|
|
|
@ -54,14 +64,14 @@ def main():
|
|
|
|
|
|
|
|
|
|
event['start_date'] = date
|
|
|
|
|
|
|
|
|
|
date += timedelta(seconds=parse_duration(event['duration'], 2)*60)
|
|
|
|
|
date += timedelta(seconds=parse_duration(event['duration'])*60)
|
|
|
|
|
if end_date is None or date > end_date:
|
|
|
|
|
end_date = date
|
|
|
|
|
|
|
|
|
|
event['end_date'] = date
|
|
|
|
|
|
|
|
|
|
timeline = []
|
|
|
|
|
timeslot = parse_duration(conference['timeslot_duration'], 2)
|
|
|
|
|
timeslot = parse_duration(conference['timeslot_duration'])
|
|
|
|
|
for offset in range(0, int((end_date-start_date).total_seconds()), GRANULARITY*60):
|
|
|
|
|
date = start_date + timedelta(seconds=offset)
|
|
|
|
|
timeline.append({'date': date.strftime('%Y-%m-%d'), 'start': offset//(timeslot*60)+1, 'time': date.strftime('%H:%M')})
|
|
|
|
|