summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-01-04 12:26:31 -0800
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-01-04 12:26:31 -0800
commitbb08ce440878522cd02a80e27de7f3e313b0ca00 (patch)
treecfa4963b47350682afdc0af898ccc6f0504c37e2
parente159f263e788188f50829d2a76cdcbf4355f9a32 (diff)
downloadmpv-iptv-menu-bb08ce440878522cd02a80e27de7f3e313b0ca00.tar.gz
mpv-iptv-menu-bb08ce440878522cd02a80e27de7f3e313b0ca00.tar.xz
reduce priority of series during search
-rw-r--r--main.lua28
1 files changed, 10 insertions, 18 deletions
diff --git a/main.lua b/main.lua
index e527f13..074cd05 100644
--- a/main.lua
+++ b/main.lua
@@ -655,17 +655,13 @@ local function search_menu_options_build(options, t, path)
local path = path or {}
for _, v in ipairs(options) do
- if not v.type then
- goto continue
- end
-
- if not t[v.type] then
- t[v.type] = {}
- end
-
local v = util.copy_table(v)
v.path = path
- t[v.type][#t[v.type]+1] = v
+ if v.type == 'group' and v.group_type ~= 'series' then
+ t.categories[#t.categories+1] = v
+ else
+ t.elements[#t.elements+1] = v
+ end
-- contents of lazy-loaded groups should not be searchable
if v.type == 'group' and not v.lazy then
@@ -674,21 +670,17 @@ local function search_menu_options_build(options, t, path)
search_menu_options_build(
group_menu_options(v), t, path)
end
-
- ::continue::
end
end
local function search_menu_options(options)
- local t = {}
+ local t = {categories = {}, elements = {}}
search_menu_options_build(options, t)
- -- display categories before streams
- local ret = t.group or {}
- if t.stream then
- for _, v in ipairs(t.stream) do
- ret[#ret+1] = v
- end
+ -- display categories first
+ local ret = t.categories
+ for _, v in ipairs(t.elements) do
+ ret[#ret+1] = v
end
return ret
end