diff options
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 32 |
1 files changed, 24 insertions, 8 deletions
@@ -152,8 +152,10 @@ local function push_menu(t) page_pos=1, } - for k, v in pairs(t) do - menu[k] = v + if t then + for k, v in pairs(t) do + menu[k] = v + end end depth = depth + 1 @@ -232,19 +234,33 @@ local function search_update_osd() update_osd() end -local function search_menu_options(options, arr) +local function search_menu_options_build(options, t) local menu = menus[depth] - local arr = arr or {} for _, v in ipairs(options) do - arr[#arr+1] = v + if not t[v.type] then + t[v.type] = {} + end + t[v.type][#t[v.type]+1] = v if v.type == 'category' then - search_menu_options( - category_menu_options(v.category_id), arr) + search_menu_options_build( + category_menu_options(v.category_id), t) + end + end +end + +local function search_menu_options(options) + local t = {} + search_menu_options_build(options, t) + + local ret = t.category or {} + if t.stream then + for _, v in ipairs(t.stream) do + ret[#ret+1] = v end end - return arr + return ret end local function search_update() |