implement data triggers

Turns out, my code was right the whole time, but the scheduled-player
package was not updated.
This commit is contained in:
Franzi 2023-09-30 10:38:51 +02:00
parent d3660931fb
commit 48a72a2757
2 changed files with 10 additions and 2 deletions

View file

@ -20,7 +20,7 @@ def idle(seconds, event_start, event_tz):
end = time.time() + seconds
log("sleeping for {} seconds".format(seconds))
while time.time() < end:
send_data = {"day": "??", "time": time.time()}
send_data = {"day": "??", "time": int(time.time())}
if event_start is not None:
event_now = datetime.now(event_tz)
utc_now = datetime.now(pytz.utc)

View file

@ -31,6 +31,11 @@ end
function M.data_trigger(path, data)
log("received data '" .. data .. "' on " .. path)
if path == "day" then
day = tonumber(data)
elseif path == "time" then
time = tonumber(data)
end
end
function M.updated_config_json(config)
@ -83,8 +88,11 @@ local function wrap(str, font, size, max_w)
end
local function check_next_talks()
time = api.clock.unix()
log("time is now " .. time)
if time == 0 then
log("No time info yet, cannot check for next talks")
return
end
room_next_talks = {}
all_next_talks = {}