mirror of https://github.com/kiwix/libkiwix.git
Allow a OPDSDumper to dump only a subset of the library.
This commit is contained in:
parent
5128861136
commit
996829e4d7
|
@ -54,7 +54,7 @@ class OPDSDumper
|
||||||
* @param id The id of the library.
|
* @param id The id of the library.
|
||||||
* @return The OPDS feed.
|
* @return The OPDS feed.
|
||||||
*/
|
*/
|
||||||
std::string dumpOPDSFeed();
|
std::string dumpOPDSFeed(const std::vector<std::string>& bookIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the id of the opds stream.
|
* Set the id of the opds stream.
|
||||||
|
|
|
@ -83,7 +83,7 @@ pugi::xml_node OPDSDumper::handleBook(Book book, pugi::xml_node root_node) {
|
||||||
return entry_node;
|
return entry_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
string OPDSDumper::dumpOPDSFeed()
|
string OPDSDumper::dumpOPDSFeed(const std::vector<std::string>& bookIds)
|
||||||
{
|
{
|
||||||
date = gen_date_str();
|
date = gen_date_str();
|
||||||
pugi::xml_document doc;
|
pugi::xml_document doc;
|
||||||
|
@ -111,8 +111,8 @@ string OPDSDumper::dumpOPDSFeed()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (library) {
|
if (library) {
|
||||||
for (auto& pair: library->books) {
|
for (auto& bookId: bookIds) {
|
||||||
handleBook(pair.second, root_node);
|
handleBook(library->getBookById(bookId), root_node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue