OPDS: Don't append Search twice for feeds with an OpenSearchDescription

This commit is contained in:
NiLuJe
2024-06-04 19:40:04 +02:00
committed by Frans de Jonge
parent 8a37917e5c
commit 08f02bf915

View File

@@ -345,6 +345,7 @@ function OPDSBrowser:genItemTableFromCatalog(catalog, item_url)
return url.absolute(item_url, href)
end
local has_opensearch = false
local hrefs = {}
if feed.link then
for __, link in ipairs(feed.link) do
@@ -362,11 +363,12 @@ function OPDSBrowser:genItemTableFromCatalog(catalog, item_url)
url = build_href(self:getSearchTemplate(build_href(link.href))),
searchable = true,
})
has_opensearch = true
end
end
-- Calibre search
-- Calibre search (also matches the actual template for OpenSearch!)
if link.type:find(self.search_template_type) and link.rel and link.rel:find("search") then
if link.href then
if link.href and not has_opensearch then
table.insert(item_table, {
text = "\u{f002} " .. _("Search"),
url = build_href(link.href:gsub("{searchTerms}", "%%s")),