service: fix stupid

This commit is contained in:
Franzi 2023-12-18 08:00:07 +01:00
parent 5ba190caa3
commit 921d5948ac

11
service
View file

@ -3,6 +3,7 @@ import os
import sys import sys
import time import time
import traceback import traceback
from calendar import timegm
from datetime import datetime, timedelta from datetime import datetime, timedelta
import pytz import pytz
@ -108,7 +109,7 @@ def main():
except Exception as e: except Exception as e:
log("getting schedule.json failed: {}".format(repr(e))) log("getting schedule.json failed: {}".format(repr(e)))
else: else:
raw_schedule = r.json() raw_schedule = r.json()["schedule"]
schedule = {"talks": []} schedule = {"talks": []}
event_start = datetime.strptime( event_start = datetime.strptime(
@ -116,18 +117,18 @@ def main():
) )
event_tz = pytz.timezone(raw_schedule["conference"]["time_zone_name"]) event_tz = pytz.timezone(raw_schedule["conference"]["time_zone_name"])
for day in raw_schedule["days"]: for day in raw_schedule["conference"]["days"]:
for room in day["rooms"].values(): for room in day["rooms"].values():
for talk in room: for talk in room:
start = datetime.strptime( start = datetime.strptime(
talk["date"][:19], "%Y-%m-%dT%H:%M%:S" talk["date"][:19], "%Y-%m-%dT%H:%M:%S"
).replace(tzinfo=event_tz) ).replace(tzinfo=event_tz)
d_h, d_m = talk["duration"].split(":") d_h, d_m = talk["duration"].split(":")
end = start + timedelta(hours=int(d_h), minutes=int(d_m)) end = start + timedelta(hours=int(d_h), minutes=int(d_m))
talk["start_ts"] = start.timestamp() talk["start_ts"] = timegm(start.timetuple())
talk["start_str"] = talk["start"] talk["start_str"] = talk["start"]
talk["end_ts"] = end.timestamp() talk["end_ts"] = timegm(end.timetuple())
talk["locale"] = talk["language"] talk["locale"] = talk["language"]
track = None track = None