Correctly get the bookIds to the opdsfeed.

We want to have LOCAL and REMOTE and VALID files.
This commit is contained in:
Matthieu Gautier 2018-10-24 15:01:46 +02:00
parent fd4f228a41
commit f691f85724

View File

@ -686,12 +686,15 @@ static struct MHD_Response* handle_catalog(RequestContext* request)
opdsDumper.setRootLocation(rootLocation);
opdsDumper.setSearchDescriptionUrl("catalog/searchdescription.xml");
opdsDumper.setId(kiwix::to_string(uuid));
opdsDumper.setLibrary(&library);
mimeType = "application/atom+xml;profile=opds-catalog;kind=acquisition; charset=utf-8";
std::vector<std::string> bookIdsToDump;
if (url == "root.xml") {
opdsDumper.setTitle("All zims");
uuid = zim::Uuid::generate(host);
bookIdsToDump = library.getBooksIds();
bookIdsToDump = library.listBooksIds(
kiwix::VALID|kiwix::LOCAL|kiwix::REMOTE);
} else if (url == "search") {
std::string query;
try {
@ -701,12 +704,14 @@ static struct MHD_Response* handle_catalog(RequestContext* request)
}
opdsDumper.setTitle("Search result for " + query);
uuid = zim::Uuid::generate();
bookIdsToDump = library.filter(query);
bookIdsToDump = library.listBooksIds(
kiwix::VALID|kiwix::LOCAL|kiwix::REMOTE,
kiwix::UNSORTED,
query);
} else {
return build_404(request, "");
}
opdsDumper.setLibrary(&library);
content = opdsDumper.dumpOPDSFeed(bookIdsToDump);
}