From c66c7e9c205bc1b63c366c73fcc284d9c73f5a2a Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Fri, 19 Oct 2018 11:48:38 +0200 Subject: [PATCH] Store the size of the book in OPDSFeed. --- src/book.cpp | 1 + src/opds_dumper.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/book.cpp b/src/book.cpp index 93a75f837..d8241f5f0 100644 --- a/src/book.cpp +++ b/src/book.cpp @@ -148,6 +148,7 @@ void Book::updateFromOpds(const pugi::xml_node& node) if (rel == "http://opds-spec.org/acquisition/open-access") { m_url = linkNode.attribute("href").value(); + m_size = strtoull(linkNode.attribute("length").value(), 0, 0); break; } } diff --git a/src/opds_dumper.cpp b/src/opds_dumper.cpp index 5caf2892a..c7e91fa86 100644 --- a/src/opds_dumper.cpp +++ b/src/opds_dumper.cpp @@ -72,6 +72,7 @@ pugi::xml_node OPDSDumper::handleBook(Book book, pugi::xml_node root_node) { acquisition_link.append_attribute("rel") = "http://opds-spec.org/acquisition/open-access"; acquisition_link.append_attribute("type") = "application/x-zim"; acquisition_link.append_attribute("href") = book.getUrl().c_str(); + acquisition_link.append_attribute("length") = std::to_string(book.getSize()).c_str(); } if (! book.getFaviconMimeType().empty() ) {