summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.lua3
-rw-r--r--osd.lua2
-rw-r--r--rt.lua26
3 files changed, 13 insertions, 18 deletions
diff --git a/main.lua b/main.lua
index c87a7bc..71abee8 100644
--- a/main.lua
+++ b/main.lua
@@ -14,10 +14,7 @@ local _xc = require('xc')
local mp_utils = require('mp.utils')
-local script_name = mp.get_script_name()
-
local state = _state.new()
-local click_state = {}
local downloader = _downloader.new({limit = 5})
local xc = _xc.new({
diff --git a/osd.lua b/osd.lua
index 7075a73..e241d24 100644
--- a/osd.lua
+++ b/osd.lua
@@ -12,7 +12,7 @@ local colour = {}
for k, v in pairs(config.colour) do
-- constructed backwards as ASS colour tags expect BGR but we configure
-- them as RGB
- tag = '&}'
+ local tag = '&}'
for byte in v:gmatch('..') do
tag = byte:upper() .. tag
end
diff --git a/rt.lua b/rt.lua
index b763f81..3cd79e0 100644
--- a/rt.lua
+++ b/rt.lua
@@ -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({