diff --git a/src/common/kiwix/manager.cpp b/src/common/kiwix/manager.cpp index 184de56ce..e73247505 100644 --- a/src/common/kiwix/manager.cpp +++ b/src/common/kiwix/manager.cpp @@ -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::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); } diff --git a/src/common/kiwix/manager.h b/src/common/kiwix/manager.h index 171a24ecb..75fe7325d 100644 --- a/src/common/kiwix/manager.h +++ b/src/common/kiwix/manager.h @@ -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 getBooksLanguages(); vector getBooksPublishers();