diff --git a/include/opds_dumper.h b/include/opds_dumper.h index 69c74e753..bdea0f8ac 100644 --- a/include/opds_dumper.h +++ b/include/opds_dumper.h @@ -63,6 +63,14 @@ class OPDSDumper */ std::string dumpOPDSFeedV2(const std::vector& 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. * diff --git a/src/opds_dumper.cpp b/src/opds_dumper.cpp index a36666e7b..61e93b266 100644 --- a/src/opds_dumper.cpp +++ b/src/opds_dumper.cpp @@ -153,6 +153,13 @@ string OPDSDumper::dumpOPDSFeedV2(const std::vector& bookIds, const 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 { const auto now = gen_date_str(); diff --git a/static/resources_list.txt b/static/resources_list.txt index 6e92fbaac..9ace25b1b 100644 --- a/static/resources_list.txt +++ b/static/resources_list.txt @@ -45,6 +45,7 @@ templates/captured_external.html templates/catalog_entries.xml templates/catalog_v2_root.xml templates/catalog_v2_entries.xml +templates/catalog_v2_complete_entry.xml templates/catalog_v2_categories.xml templates/catalog_v2_languages.xml opensearchdescription.xml diff --git a/static/templates/catalog_v2_complete_entry.xml b/static/templates/catalog_v2_complete_entry.xml new file mode 100644 index 000000000..cd4abe5f2 --- /dev/null +++ b/static/templates/catalog_v2_complete_entry.xml @@ -0,0 +1,29 @@ + + + urn:uuid:{{id}} + {{title}} + {{description}} + {{language}} + {{updated}} + {{name}} + {{flavour}} + {{category}} + {{tags}} + {{article_count}} + {{media_count}} + {{#icons}} + + {{/icons}} + + + {{author_name}} + + + {{publisher_name}} + + {{#url}} + + {{/url}} +