make "hide talks older than x minutes" configurable

This commit is contained in:
Franzi 2023-12-27 13:07:50 +01:00
parent 45de0d6f29
commit 645f1af466
3 changed files with 14 additions and 3 deletions

View file

@ -58,12 +58,19 @@
"type": "boolean",
"default": true
}, {
"title": "Clock format",
"title": "Clock Format",
"ui_width": 4,
"name": "clock_format",
"type": "string",
"default": "%H:%M",
"hint": "strftime() format specifier"
}, {
"title": "Hide Talks Older Than",
"ui_width": 4,
"name": "hide_talks_older_than_minutes",
"type": "integer",
"default": 25,
"hint": "Hide talks from schedule view if they started more than X minutes ago. Talks that have already ended will never be shown."
}, {
"title": "Schedule",
"type": "section"

View file

@ -19,6 +19,7 @@ local tracks = {}
local all_next_talks = {}
local show_language = true
local show_track = true
local hide_talks_older_than_minutes = 25
gl.setup(NATIVE_WIDTH, NATIVE_HEIGHT)
@ -38,6 +39,7 @@ util.file_watch("config.json", function(content)
log("running on device ".. tostring(sys.get_env "SERIAL"))
show_language = config.show_language
show_track = config.show_track
hide_talks_older_than_minutes = config.hide_talks_older_than_minutes
font_clock = resource.load_font(config.font_clock.asset_name)
font_day = resource.load_font(config.font_day.asset_name)
@ -73,7 +75,7 @@ local function check_next_talks()
all_next_talks = {}
local min_start = time - 25 * 60
local min_start = time - hide_talks_older_than_minutes * 60
for idx = 1, #schedule do
local talk = schedule[idx]

View file

@ -25,6 +25,7 @@ local time = 0
local clock = "??"
local show_language = true
local show_track = true
local hide_talks_older_than_minutes = 25
local M = {}
@ -51,6 +52,7 @@ function M.updated_config_json(config)
log("running on device ".. tostring(sys.get_env "SERIAL"))
show_language = config.show_language
show_track = config.show_track
hide_talks_older_than_minutes = config.hide_talks_older_than_minutes
font_clock = resource.load_font(api.localized(config.font_clock.asset_name))
font_day = resource.load_font(api.localized(config.font_day.asset_name))
@ -109,7 +111,7 @@ local function check_next_talks()
room_next_talks = {}
all_next_talks = {}
local min_start = time - 25 * 60
local min_start = time - hide_talks_older_than_minutes * 60
if current_room then
log("my room is '" .. current_room .. "'")