use OrderedDict for schedule, because order of rooms is important

This commit is contained in:
Franzi 2024-12-26 16:51:56 +01:00
parent 0206873096
commit f841594488

View file

@ -8,6 +8,8 @@ from datetime import datetime, timedelta
import pytz import pytz
from requests import get from requests import get
from json import JSONDecoder
from collections import OrderedDict
from hosted import config, node from hosted import config, node
@ -146,7 +148,7 @@ def main():
# info json blob atleast once, we have all the information # info json blob atleast once, we have all the information
# we need. # we need.
else: else:
schedule = r.json() schedule = JSONDecoder(object_pairs_hook=OrderedDict).decode(r.text)
tracks = {} tracks = {}
for talk in schedule["talks"]: for talk in schedule["talks"]:
talk["start_str"] = ( talk["start_str"] = (
@ -177,7 +179,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()["schedule"] raw_schedule = JSONDecoder(object_pairs_hook=OrderedDict).decode(r.text)["schedule"]
schedule = { schedule = {
"tracks": raw_schedule["conference"]["tracks"], "tracks": raw_schedule["conference"]["tracks"],
"talks": [], "talks": [],