From 82526665364389d92e0f2c33eba04678275863bb Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Tue, 27 Jan 2026 01:12:16 -0800 Subject: on-demand calculation and update of option info Using metatables to calculate info strings on render, we can avoid precomputing it for all options when generating the menu, making certain menus open much faster. This also allows us to update dynamic info, e.g. the currently programme, while the menu is open. --- epg.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'epg.lua') diff --git a/epg.lua b/epg.lua index c7af266..a3d84f2 100644 --- a/epg.lua +++ b/epg.lua @@ -66,4 +66,17 @@ function mt:scheduled_programme(ch, time) end end +function mt:next_programme(ch, time) + local progs = self.channels[ch] + if not progs then + return + end + + for _, v in ipairs(progs) do + if v.start > time then + return v + end + end +end + return epg -- cgit v1.2.3-70-g09d2