summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2025-05-11 17:19:58 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2025-05-11 17:20:28 -0700
commit10a6c510f6f92ce44a063f5e0edf206ee9d9ce4d (patch)
tree02c09d4fab26520cb12fb372683ad80cae6f9192
parenta1925e39f9276270590f7a716ba34f1fe9ed65e4 (diff)
downloadmpv-iptv-menu-10a6c510f6f92ce44a063f5e0edf206ee9d9ce4d.tar.gz
mpv-iptv-menu-10a6c510f6f92ce44a063f5e0edf206ee9d9ce4d.tar.xz
create catchall categories
-rw-r--r--main.lua18
1 files changed, 17 insertions, 1 deletions
diff --git a/main.lua b/main.lua
index 3cb55ec..fd6f75b 100644
--- a/main.lua
+++ b/main.lua
@@ -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