summaryrefslogtreecommitdiff
path: root/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua44
1 files changed, 18 insertions, 26 deletions
diff --git a/main.lua b/main.lua
index d0d2489..6e04001 100644
--- a/main.lua
+++ b/main.lua
@@ -42,7 +42,20 @@ xc = cacher.wrap(xc, {
local catalogue = _catalogue.new()
local epg = _epg.new()
-local osd = _osd.new()
+local osd = _osd.new({
+ img_path_func = function(url, cb)
+ local path = mp_utils.join_path(
+ config.img_dir, url:gsub('%W', '_'))
+
+ if not mp_utils.file_info(path) and cb then
+ downloader:schedule(url, path, function(_, path)
+ cb(path)
+ end)
+ end
+
+ return path
+ end,
+})
local key_bindings = {}
@@ -54,27 +67,6 @@ local function osd_menu_lines()
return osd:menu_lines(state)
end
--- FIXME leaving this here as a global for now since the image is downloaded
--- during osd redraw but this function has other dependencies
-function get_image_path(url, dl)
- local path = mp_utils.join_path(config.img_dir, url:gsub('%W', '_'))
-
- local f = mp_utils.file_info(path)
- if f then
- return path
- end
-
- if dl then
- downloader:schedule(url, path, function(_, file)
- if osd.img and file == osd.img.path then
- osd:draw_image()
- end
- end)
-
- return path
- end
-end
-
local function load_data()
local arr = {
{id = 'live', name = 'Live TV', type = 'live'},
@@ -310,12 +302,12 @@ local function series_group_menu_options(series)
id = series.section .. ':stream:' ..
episode.id,
stream_id = episode.id,
- image = util.strip_ne(
+ img_url = util.strip_ne(
epinfo.movie_image),
}
t.info_data = {
name = t.name,
- cover = t.image,
+ cover = t.img_url,
description = epinfo.plot,
releasedate = epinfo.releasedate,
duration = epinfo.duration,
@@ -338,12 +330,12 @@ local function series_group_menu_options(series)
children = episodes,
name = util.strip(season.name),
info = count,
- image = util.strip_ne(season.cover_big) or
+ img_url = util.strip_ne(season.cover_big) or
util.strip_ne(season.cover),
}
t.info_data = {
name = t.name,
- cover = t.image,
+ cover = t.img_url,
description = season.overview,
releasedate = season.air_date,
num_episodes = count,