mirror of https://github.com/kiwix/libkiwix.git
+ improve filter
This commit is contained in:
parent
5cd20c8fa7
commit
aadce46adf
|
@ -435,7 +435,8 @@ namespace kiwix {
|
|||
return result;
|
||||
}
|
||||
|
||||
bool Manager::listBooks(const supportedListMode mode, const supportedListSortBy sortBy, const unsigned int maxSize) {
|
||||
bool Manager::listBooks(const supportedListMode mode, const supportedListSortBy sortBy, const unsigned int maxSize,
|
||||
const string language, const string publisher) {
|
||||
this->bookIdList.clear();
|
||||
std::vector<kiwix::Book>::iterator itr;
|
||||
|
||||
|
@ -470,6 +471,12 @@ namespace kiwix {
|
|||
if (atoi(itr->size.c_str()) > maxSize * 1024 * 1024)
|
||||
ok = false;
|
||||
|
||||
if (!language.empty() && itr->language != language)
|
||||
ok = false;
|
||||
|
||||
if (!publisher.empty() && itr->creator != publisher)
|
||||
ok = false;
|
||||
|
||||
if (ok == true)
|
||||
this->bookIdList.push_back(itr->id);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,8 @@ namespace kiwix {
|
|||
unsigned int getBookCount(const bool localBooks, const bool remoteBooks);
|
||||
bool updateBookLastOpenDateById(const string id);
|
||||
void removeBookPaths();
|
||||
bool listBooks(const supportedListMode mode, const supportedListSortBy sortBy, const unsigned int maxSize);
|
||||
bool listBooks(const supportedListMode mode, const supportedListSortBy sortBy, const unsigned int maxSize,
|
||||
const string language, const string publisher);
|
||||
vector<string> getBooksLanguages();
|
||||
vector<string> getBooksPublishers();
|
||||
|
||||
|
|
Loading…
Reference in New Issue