summaryrefslogtreecommitdiff
path: root/catalogue.lua
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-02-03 22:42:26 -0800
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-02-03 22:42:26 -0800
commit554e833b1a39ede9aef234449fc8992435f10751 (patch)
tree3b5e7cf0077c6b758eafd76a97bfc81f5ba15145 /catalogue.lua
parent6cc548c27470b81114412f3ecd74380894eba72e (diff)
downloadmpv-iptv-menu-554e833b1a39ede9aef234449fc8992435f10751.tar.gz
mpv-iptv-menu-554e833b1a39ede9aef234449fc8992435f10751.tar.xz
support multiple sources
Diffstat (limited to 'catalogue.lua')
-rw-r--r--catalogue.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/catalogue.lua b/catalogue.lua
index 7f83e82..425dc17 100644
--- a/catalogue.lua
+++ b/catalogue.lua
@@ -22,19 +22,20 @@ function mt:get(id)
return self.data[id]
end
-function mt:_ensure_catchall(section_id)
- local id = section_id .. ':category:catchall'
+function mt:_ensure_catchall(src_id, section)
+ local id = src_id .. ':' .. section .. ':cat:catchall'
local entry = self.data[id]
if entry then
return entry
end
return self:add({
- section = section_id,
+ src_id = src_id,
+ section = section,
type = 'group',
- group_type = 'category',
+ group_type = 'cat',
id = id,
- parent_id = section_id .. ':category:0',
+ parent_id = src_id .. ':' .. section .. ':cat:0',
-- non-ascii symbol to sort near end
name = '∗CATCHALL∗',
})
@@ -56,7 +57,7 @@ function mt:add(entry)
-- dump any entries referencing nonexistent categories into a single
-- catchall category
if not parent then
- parent = self:_ensure_catchall(entry.section)
+ parent = self:_ensure_catchall(entry.src_id, entry.section)
entry.parent_id = parent.id
end