service: fix tracks display in pretalx-broadcast-tools mode

this fixes #5
This commit is contained in:
Franzi 2024-01-16 08:47:47 +01:00
parent d39b59d52e
commit e2d154226f

13
service
View file

@ -98,7 +98,7 @@ def main():
# we need.
else:
schedule = r.json()
schedule["tracks"] = []
tracks = {}
for talk in schedule["talks"]:
talk["start_str"] = (
datetime.fromtimestamp(talk["start_ts"])
@ -106,6 +106,17 @@ def main():
.astimezone(event_tz)
.strftime("%H:%M")
)
if talk["track"]:
if talk["track"]["name"] not in tracks:
tracks[talk["track"]["name"]] = talk["track"]["color"]
schedule["tracks"] = []
for name, color in sorted(tracks.items()):
schedule["tracks"].append(
{
"name": name,
"color": color,
}
)
node.write_json("schedule.json", schedule)
log("updated schedule json")
elif config["json_flavour"] == "voc-schema":