Compare commits
No commits in common. "756177089df4c0138f23d23b48839e5499171508" and "8eb1273273e38afffc896c395ce9d74179c63306" have entirely different histories.
756177089d
...
8eb1273273
|
@ -1,6 +1,6 @@
|
||||||
# fairydust.reisen website
|
# fairydust.reisen website
|
||||||
|
|
||||||
Schedule version: `Intercrus`
|
Schedule version: `Hadar`
|
||||||
|
|
||||||
## New pages/posts
|
## New pages/posts
|
||||||
|
|
||||||
|
|
|
@ -7,25 +7,15 @@ from urllib.request import urlopen
|
||||||
from zoneinfo import ZoneInfo
|
from zoneinfo import ZoneInfo
|
||||||
|
|
||||||
GRANULARITY = 30
|
GRANULARITY = 30
|
||||||
ROOM_SEQUENCE = ('Sondermaschinenbau', 'Smart City Schmiede', 'Sofaecke', 'Außenbereich', 'Rennstrecke', 'Cyberspace')
|
ROOM_SEQUENCE = ('Sondermaschinenbau', 'Smart City Schmiede', 'Sofaecke', 'CTF')
|
||||||
SCHEDULE_URL = 'https://cfp.fairydust.reisen/iger-2022/schedule/export/schedule.json'
|
SCHEDULE_URL = 'https://cfp.fairydust.reisen/iger-2022/schedule/export/schedule.json'
|
||||||
TIMEZONE = 'Europe/Berlin'
|
TIMEZONE = 'Europe/Berlin'
|
||||||
|
|
||||||
def parse_duration(s):
|
def parse_duration(s, num_parts):
|
||||||
duration = 0
|
duration = 0
|
||||||
components = s.split(':')
|
for t in s.split(':', maxsplit=num_parts-1):
|
||||||
|
|
||||||
if len(components) == 3:
|
|
||||||
duration += int(components[0])
|
|
||||||
duration *= 24
|
|
||||||
components = components[1:]
|
|
||||||
|
|
||||||
if len(components) == 2:
|
|
||||||
duration += int(components[0])
|
|
||||||
duration *= 60
|
duration *= 60
|
||||||
duration += int(components[1])
|
duration += int(t)
|
||||||
else:
|
|
||||||
raise RuntimeError(f'invalid duration format: {s}')
|
|
||||||
|
|
||||||
return duration
|
return duration
|
||||||
|
|
||||||
|
@ -64,14 +54,14 @@ def main():
|
||||||
|
|
||||||
event['start_date'] = date
|
event['start_date'] = date
|
||||||
|
|
||||||
date += timedelta(seconds=parse_duration(event['duration'])*60)
|
date += timedelta(seconds=parse_duration(event['duration'], 2)*60)
|
||||||
if end_date is None or date > end_date:
|
if end_date is None or date > end_date:
|
||||||
end_date = date
|
end_date = date
|
||||||
|
|
||||||
event['end_date'] = date
|
event['end_date'] = date
|
||||||
|
|
||||||
timeline = []
|
timeline = []
|
||||||
timeslot = parse_duration(conference['timeslot_duration'])
|
timeslot = parse_duration(conference['timeslot_duration'], 2)
|
||||||
for offset in range(0, int((end_date-start_date).total_seconds()), GRANULARITY*60):
|
for offset in range(0, int((end_date-start_date).total_seconds()), GRANULARITY*60):
|
||||||
date = start_date + timedelta(seconds=offset)
|
date = start_date + timedelta(seconds=offset)
|
||||||
timeline.append({'date': date.strftime('%Y-%m-%d'), 'start': offset//(timeslot*60)+1, 'time': date.strftime('%H:%M')})
|
timeline.append({'date': date.strftime('%Y-%m-%d'), 'start': offset//(timeslot*60)+1, 'time': date.strftime('%H:%M')})
|
||||||
|
|
Loading…
Reference in New Issue