diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2025-05-11 17:19:58 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2025-05-11 17:20:28 -0700 |
commit | 10a6c510f6f92ce44a063f5e0edf206ee9d9ce4d (patch) | |
tree | 02c09d4fab26520cb12fb372683ad80cae6f9192 | |
parent | a1925e39f9276270590f7a716ba34f1fe9ed65e4 (diff) | |
download | mpv-iptv-menu-10a6c510f6f92ce44a063f5e0edf206ee9d9ce4d.tar.gz mpv-iptv-menu-10a6c510f6f92ce44a063f5e0edf206ee9d9ce4d.tar.xz |
create catchall categories
-rw-r--r-- | main.lua | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -76,10 +76,26 @@ local function add_object(obj) obj.children = {} end - if not obj.parent_id or not objects[obj.parent_id] then + if not obj.parent_id then return end + -- dump any objects referencing nonexistent categories into a single + -- catchall category + if not objects[obj.parent_id] then + obj.parent_id = obj.section .. ':category:catchall' + if not objects[obj.parent_id] then + add_object({ + section=obj.section, + type='group', + group_type='category', + id=obj.parent_id, + parent_id=obj.section .. ':category:0', + name='*CATCHALL*', + }) + end + end + local parent_children = objects[obj.parent_id].children parent_children[#parent_children+1] = obj end |