diff options
| author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2026-01-27 19:03:30 -0800 |
|---|---|---|
| committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2026-01-27 19:03:30 -0800 |
| commit | e985711d6dbd25833eb4069142b0788c1b943c36 (patch) | |
| tree | 9c923c8688cb4093f4bf002881c0b1af5676deb9 /rt.lua | |
| parent | 7e905af2fa427258f3ef59a000e7cea78ce0bf1a (diff) | |
| download | mpv-iptv-menu-e985711d6dbd25833eb4069142b0788c1b943c36.tar.gz mpv-iptv-menu-e985711d6dbd25833eb4069142b0788c1b943c36.tar.xz | |
live active state in EPG
Diffstat (limited to 'rt.lua')
| -rw-r--r-- | rt.lua | 26 |
1 files changed, 12 insertions, 14 deletions
@@ -388,17 +388,6 @@ local function sort_options(options) end) end -local function add_programme(opt, time) - if opt.epg_channel_id then - local prog = ctx.epg:scheduled_programme( - opt.epg_channel_id, time) - if prog then - opt.info = prog.title - end - end -end - -local menu_option_mt_count = 0 local menu_option_mt = { __index = function(t, k) local v = t._v @@ -653,6 +642,16 @@ local function open_epg_programme(prog, img_url) osd:dirty() end +local epg_programme_mt = { + __index = function(t, k) + if k == 'active' then + local time = osd.redraw_time + local v = t.programme + return time >= v.start and time < v.stop + end + end, +} + local function open_option_epg(opt) local ch = opt.epg_channel_id:lower() local progs = ctx.epg:channel_programmes(ch) @@ -664,7 +663,7 @@ local function open_option_epg(opt) local curr = 0 local time = os.time() for i, v in ipairs(progs) do - prog = { + local prog = { name = os.date('%a %d %b %H:%M', v.start) .. ' ' .. os.date('%H:%M', v.stop) .. ' ' .. v.title, info = v.desc, @@ -673,10 +672,9 @@ local function open_option_epg(opt) if curr == 0 and time >= v.start and time < v.stop then curr = i - prog.active = true end - options[i] = prog + options[i] = setmetatable(prog, epg_programme_mt) end local menu = state:push_menu({ |
