mirror of
https://github.com/Kunsi/scheduled-plugin-pretalx-broadcast-tools.git
synced 2024-12-21 16:02:42 +00:00
write correct room name if using uuids
This commit is contained in:
parent
cc8bcc1233
commit
de084a0a6a
2 changed files with 18 additions and 5 deletions
7
service
7
service
|
@ -67,11 +67,14 @@ def main():
|
|||
|
||||
while True:
|
||||
schedule_url = config["schedule_url"]
|
||||
room_uuid_mapping = {}
|
||||
|
||||
if "example.com" in schedule_url:
|
||||
log("default schedule url, waiting for config update")
|
||||
# sleep forever, service will get restarted if the config
|
||||
# changes.
|
||||
time.sleep(99999999)
|
||||
|
||||
log("event url: {}".format(schedule_url))
|
||||
log("using json flavour: {}".format(config["json_flavour"]))
|
||||
|
||||
|
@ -91,7 +94,6 @@ 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")
|
||||
|
@ -146,7 +148,6 @@ def main():
|
|||
"talks": [],
|
||||
}
|
||||
|
||||
room_uuid_mapping = {}
|
||||
for room in raw_schedule["conference"]["rooms"]:
|
||||
room_uuid_mapping[room["name"]] = room["guid"]
|
||||
|
||||
|
@ -206,6 +207,8 @@ def main():
|
|||
else:
|
||||
log("unknown json flavour, something is very wrong")
|
||||
|
||||
node.write_json("uuid.json", room_uuid_mapping)
|
||||
|
||||
idle(30, event_start, event_end, event_tz)
|
||||
|
||||
|
||||
|
|
16
tile.lua
16
tile.lua
|
@ -91,6 +91,11 @@ function M.updated_schedule_json(new_schedule)
|
|||
schedule = new_schedule.talks
|
||||
end
|
||||
|
||||
function M.updated_uuid_json(new_uuids)
|
||||
log("new room uuid mapping")
|
||||
rooms = new_uuids
|
||||
end
|
||||
|
||||
local function wrap(str, font, size, max_w)
|
||||
local lines = {}
|
||||
local space_w = font:width(" ", size)
|
||||
|
@ -395,20 +400,25 @@ local function view_room(starts, ends, config, x1, y1, x2, y2)
|
|||
return a.add(anims.moving_font(S, E, ...))
|
||||
end
|
||||
|
||||
local room_name = current_room;
|
||||
if rooms[current_room] ~= nil then
|
||||
room_name = rooms[current_room]
|
||||
end
|
||||
|
||||
local x = 0
|
||||
local w = font_room:width(current_room, font_size)
|
||||
local w = font_room:width(room_name, font_size)
|
||||
if align == "right" then
|
||||
x = a.width - w
|
||||
elseif align == "center" then
|
||||
x = (a.width - w) / 2
|
||||
end
|
||||
text(font_room, x, 0, current_room, font_size, rgba(default_color,1))
|
||||
text(font_room, x, 0, room_name, font_size, rgba(default_color,1))
|
||||
|
||||
for now in api.frame_between(starts, ends) do
|
||||
if animate then
|
||||
a.draw(now, x1, y1, x2, y2)
|
||||
else
|
||||
font_room:write(x1+x, y1, current_room, font_size, r,g,b,1)
|
||||
font_room:write(x1+x, y1, room_name, font_size, r,g,b,1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue