add option to use room uuid instead of room name

This commit is contained in:
Franzi 2024-10-31 21:54:24 +01:00
parent 927adfa0da
commit cc8bcc1233
3 changed files with 13 additions and 3 deletions

View file

@ -98,11 +98,11 @@
"itemname": "Room",
"hint": "Define all rooms in your schedule and assign them to devices",
"items": [{
"title": "Room Name",
"title": "Room Name or UUID",
"ui_width": 6,
"name": "name",
"type": "string",
"hint": "Name of this room in your events native language",
"hint": "Name of this room in your events native language or room UUID",
"default": ""
}, {
"title": "Serial",

10
service
View file

@ -91,10 +91,13 @@ def main():
else:
event_info = r.json()
room_uuid_mapping = {}
if event_info is not None:
event_start = datetime.strptime(event_info["start"], "%Y-%m-%d")
event_end = datetime.strptime(event_info["end"], "%Y-%m-%d")
event_tz = pytz.timezone(event_info["timezone"])
for uuid, room_name in event_info.get("rooms", {}).items():
room_uuid_mapping[room_name] = uuid
try:
r = get(
@ -116,6 +119,7 @@ def main():
.astimezone(event_tz)
.strftime("%H:%M")
)
talk["room_uuid"] = room_uuid_mapping.get("room")
if talk["track"]:
if talk["track"]["name"] not in tracks:
tracks[talk["track"]["name"]] = talk["track"]["color"]
@ -142,6 +146,10 @@ def main():
"talks": [],
}
room_uuid_mapping = {}
for room in raw_schedule["conference"]["rooms"]:
room_uuid_mapping[room["name"]] = room["guid"]
event_start = datetime.strptime(
raw_schedule["conference"]["start"][:10], "%Y-%m-%d"
)
@ -183,6 +191,8 @@ def main():
break
talk["track"] = track
talk["room_uuid"] = room_uuid_mapping.get(talk["room"])
persons = []
for p in talk["persons"]:
name = p.get("public_name", p.get("name"))

View file

@ -139,7 +139,7 @@ local function check_next_talks()
-- to announce these.
if talk.end_ts > time and talk.start_ts > min_start then
-- is this in *this* room, or somewhere else?
if current_room and talk.room == current_room then
if current_room and (talk.room == current_room or talk.room_uuid == current_room) then
room_next_talks[#room_next_talks+1] = talk
end
all_next_talks[#all_next_talks+1] = talk