OPDSDumper::categoriesOPDSFeed() with no args

This commit is contained in:
Veloman Yunkan 2021-07-08 16:14:34 +04:00 committed by Matthieu Gautier
parent dd118df612
commit 96cf7e78a5
3 changed files with 4 additions and 5 deletions

View File

@ -66,10 +66,9 @@ class OPDSDumper
/** /**
* Dump the categories OPDS feed. * Dump the categories OPDS feed.
* *
* @param categories list of category names
* @return The OPDS feed. * @return The OPDS feed.
*/ */
std::string categoriesOPDSFeed(const std::vector<std::string>& categories) const; std::string categoriesOPDSFeed() const;
/** /**
* Dump the languages OPDS feed. * Dump the languages OPDS feed.

View File

@ -140,11 +140,11 @@ string OPDSDumper::dumpOPDSFeedV2(const std::vector<std::string>& bookIds, const
return render_template(RESOURCE::templates::catalog_v2_entries_xml, template_data); return render_template(RESOURCE::templates::catalog_v2_entries_xml, template_data);
} }
std::string OPDSDumper::categoriesOPDSFeed(const std::vector<std::string>& categories) const std::string OPDSDumper::categoriesOPDSFeed() const
{ {
const auto now = gen_date_str(); const auto now = gen_date_str();
kainjow::mustache::list categoryData; kainjow::mustache::list categoryData;
for ( const auto& category : categories ) { for ( const auto& category : library->getBooksCategories() ) {
const auto urlencodedCategoryName = urlEncode(category); const auto urlencodedCategoryName = urlEncode(category);
categoryData.push_back(kainjow::mustache::object{ categoryData.push_back(kainjow::mustache::object{
{"name", category}, {"name", category},

View File

@ -104,7 +104,7 @@ std::unique_ptr<Response> InternalServer::handle_catalog_v2_categories(const Req
opdsDumper.setLibraryId(m_library_id); opdsDumper.setLibraryId(m_library_id);
return ContentResponse::build( return ContentResponse::build(
*this, *this,
opdsDumper.categoriesOPDSFeed(mp_library->getBooksCategories()), opdsDumper.categoriesOPDSFeed(),
"application/atom+xml;profile=opds-catalog;kind=navigation" "application/atom+xml;profile=opds-catalog;kind=navigation"
); );
} }