From cda419dd7a9d1932bfa847b9b942b97bc2c1b14f Mon Sep 17 00:00:00 2001 From: bigdale123 Date: Thu, 20 Oct 2022 09:45:05 -0500 Subject: [PATCH] OPDS-PS: Fix hardcoded namespace in count (#9650) Turns out the namespace is dynamic, so, just look for ':count' and hope there won't be any conflicts ;). --- plugins/opds.koplugin/opdsbrowser.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/opds.koplugin/opdsbrowser.lua b/plugins/opds.koplugin/opdsbrowser.lua index 47d0854e2..d0f4a27b1 100644 --- a/plugins/opds.koplugin/opdsbrowser.lua +++ b/plugins/opds.koplugin/opdsbrowser.lua @@ -504,12 +504,22 @@ function OPDSBrowser:genItemTableFromCatalog(catalog, item_url, username, passwo title = link.title, }) elseif link.rel == self.stream_rel then + -- This for loop iterates through all keys in a + -- Entry and looks for the count tag, then stores + -- That key to use for updating the table value. + local count_key = "" + for k, v in pairs(link) do + if string.sub(k, -6) == ":count" then + count_key = k + break + end + end table.insert(item.acquisitions, { type = link.type, href = build_href(link.href), title = link.title, stream = true, - count = tonumber(link["pse:count"] or "1"), + count = tonumber(link[count_key] or "1"), }) elseif link.rel == self.thumbnail_rel then item.thumbnail = build_href(link.href)