OPDSDumper::dumpOPDSCompleteEntry()

This commit is contained in:
Veloman Yunkan 2021-09-01 21:54:59 +04:00
parent 027854e4f4
commit 12d9b69806
4 changed files with 45 additions and 0 deletions

View File

@ -63,6 +63,14 @@ class OPDSDumper
*/ */
std::string dumpOPDSFeedV2(const std::vector<std::string>& bookIds, const std::string& query) const; std::string dumpOPDSFeedV2(const std::vector<std::string>& bookIds, const std::string& query) const;
/**
* Dump the OPDS complete entry document.
*
* @param bookId the id of the book
* @return The OPDS complete entry document.
*/
std::string dumpOPDSCompleteEntry(const std::string& bookId) const;
/** /**
* Dump the categories OPDS feed. * Dump the categories OPDS feed.
* *

View File

@ -153,6 +153,13 @@ 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::dumpOPDSCompleteEntry(const std::string& bookId) const
{
const auto bookData = getSingleBookData(library->getBookById(bookId));
return render_template(RESOURCE::templates::catalog_v2_complete_entry_xml, bookData);
}
std::string OPDSDumper::categoriesOPDSFeed() const std::string OPDSDumper::categoriesOPDSFeed() const
{ {
const auto now = gen_date_str(); const auto now = gen_date_str();

View File

@ -45,6 +45,7 @@ templates/captured_external.html
templates/catalog_entries.xml templates/catalog_entries.xml
templates/catalog_v2_root.xml templates/catalog_v2_root.xml
templates/catalog_v2_entries.xml templates/catalog_v2_entries.xml
templates/catalog_v2_complete_entry.xml
templates/catalog_v2_categories.xml templates/catalog_v2_categories.xml
templates/catalog_v2_languages.xml templates/catalog_v2_languages.xml
opensearchdescription.xml opensearchdescription.xml

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<entry>
<id>urn:uuid:{{id}}</id>
<title>{{title}}</title>
<summary>{{description}}</summary>
<language>{{language}}</language>
<updated>{{updated}}</updated>
<name>{{name}}</name>
<flavour>{{flavour}}</flavour>
<category>{{category}}</category>
<tags>{{tags}}</tags>
<articleCount>{{article_count}}</articleCount>
<mediaCount>{{media_count}}</mediaCount>
{{#icons}}
<link rel="http://opds-spec.org/image/thumbnail"
href="/meta?name=Illustration_{{icon_width}}x{{icon_height}}@{{icon_scale}}&amp;content={{{content_id}}}"
type="image/png;width={{icon_width}};height={{icon_height}};scale={{icon_scale}}"/>
{{/icons}}
<link type="text/html" href="/{{{content_id}}}" />
<author>
<name>{{author_name}}</name>
</author>
<publisher>
<name>{{publisher_name}}</name>
</publisher>
{{#url}}
<link rel="http://opds-spec.org/acquisition/open-access" type="application/x-zim" href="{{{url}}}" length="{{{size}}}" />
{{/url}}
</entry>