summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2025-12-19 21:29:02 -0800
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2025-12-19 21:29:02 -0800
commite538e3e5e4525d2964bbfd80874909a8aa384505 (patch)
treee926bbd26737c8d7d5e8b0310adcc8657d6b58bb
parent6c2c8d7522354531d70103bad60283f40f45011e (diff)
downloadmpv-iptv-menu-e538e3e5e4525d2964bbfd80874909a8aa384505.tar.gz
mpv-iptv-menu-e538e3e5e4525d2964bbfd80874909a8aa384505.tar.xz
only cache on success
-rw-r--r--main.lua5
-rw-r--r--xc.lua8
2 files changed, 11 insertions, 2 deletions
diff --git a/main.lua b/main.lua
index 926a455..9b9a697 100644
--- a/main.lua
+++ b/main.lua
@@ -126,6 +126,10 @@ local function cached_xc_call(method)
end
local data = xc[method](xc)
+ if not data then
+ return
+ end
+
util.write_json_file(path, data)
return data
end
@@ -698,7 +702,6 @@ end
local function series_group_menu_options(series)
local info = xc:get_series_info(series.series_id)
-
if not info or not info.seasons then
return {}
end
diff --git a/xc.lua b/xc.lua
index b96d2a1..723f9cb 100644
--- a/xc.lua
+++ b/xc.lua
@@ -37,7 +37,10 @@ function mt:get(path, params)
end
function mt:api_get(params)
- return mp_utils.parse_json(self:get('/player_api.php', params))
+ local json = self:get('/player_api.php', params)
+ if json then
+ return mp_utils.parse_json(json)
+ end
end
function mt:get_live_categories()
@@ -74,6 +77,9 @@ end
function mt:get_epg()
local xml = self:get('/xmltv.php')
+ if not xml then
+ return
+ end
-- this is a bit retarded, but using python to convert xml to json
-- avoids having to write an xml parser or pull in external