OPDS: Handle searching in Calibre's OPDS server

Re: #11968
This commit is contained in:
NiLuJe
2024-06-04 19:02:29 +02:00
committed by Frans de Jonge
parent f2691b833e
commit f3a67a4f4d

View File

@@ -279,6 +279,7 @@ function OPDSBrowser:fetchFeed(item_url, headers_only)
text = text,
icon = icon,
})
logger.dbg(string.format("OPDS: Failed to fetch catalog `%s`: %s", item_url, text))
end
-- Parses feed to catalog
@@ -353,6 +354,7 @@ function OPDSBrowser:genItemTableFromCatalog(catalog, item_url)
hrefs[link.rel] = build_href(link.href)
end
end
-- OpenSearch
if link.type:find(self.search_type) then
if link.href then
table.insert(item_table, { -- the first item in each subcatalog
@@ -362,6 +364,16 @@ function OPDSBrowser:genItemTableFromCatalog(catalog, item_url)
})
end
end
-- Calibre search
if link.type:find(self.search_template_type) and link.rel and link.rel:find("search") then
if link.href then
table.insert(item_table, {
text = "\u{f002} " .. _("Search"),
url = build_href(link.href:gsub("{searchTerms}", "%%s")),
searchable = true,
})
end
end
end
end
end