From bb08ce440878522cd02a80e27de7f3e313b0ca00 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 4 Jan 2026 12:26:31 -0800 Subject: reduce priority of series during search --- main.lua | 28 ++++++++++------------------ 1 file 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 -- cgit v1.2.3-70-g09d2