mirror of https://github.com/kiwix/libkiwix.git
Modified Kiwix-manage to incorporate origID parameter for diff files in the kiwix library.
Book class and Manager class modified. -Kiran
This commit is contained in:
parent
69f43266c0
commit
7fd2dce1fa
|
@ -67,6 +67,7 @@ namespace kiwix {
|
|||
string publisher;
|
||||
string date;
|
||||
string url;
|
||||
string origID;
|
||||
string articleCount;
|
||||
string mediaCount;
|
||||
bool readOnly;
|
||||
|
|
|
@ -56,6 +56,7 @@ namespace kiwix {
|
|||
book.creator = bookNode.attribute("creator").value();
|
||||
book.publisher = bookNode.attribute("publisher").value();
|
||||
book.url = bookNode.attribute("url").value();
|
||||
book.origID = bookNode.attribute("origId").value();
|
||||
book.articleCount = bookNode.attribute("articleCount").value();
|
||||
book.mediaCount = bookNode.attribute("mediaCount").value();
|
||||
book.size = bookNode.attribute("size").value();
|
||||
|
@ -177,6 +178,9 @@ namespace kiwix {
|
|||
if (itr->url != "")
|
||||
bookNode.append_attribute("url") = itr->url.c_str();
|
||||
|
||||
if (itr->origID != "")
|
||||
bookNode.append_attribute("origId") = itr->origID.c_str();
|
||||
|
||||
if (itr->articleCount != "")
|
||||
bookNode.append_attribute("articleCount") = itr->articleCount.c_str();
|
||||
|
||||
|
@ -217,7 +221,7 @@ namespace kiwix {
|
|||
|
||||
/* Add a book to the library. Return empty string if failed, book id otherwise */
|
||||
string Manager::addBookFromPathAndGetId(const string pathToOpen, const string pathToSave,
|
||||
const string url, const bool checkMetaData) {
|
||||
const string url, const string origId, const bool checkMetaData) {
|
||||
kiwix::Book book;
|
||||
|
||||
if (this->readBookFromPath(pathToOpen, &book)) {
|
||||
|
@ -231,6 +235,7 @@ namespace kiwix {
|
|||
if (!checkMetaData ||
|
||||
(checkMetaData && !book.title.empty() && !book.language.empty() && !book.date.empty())) {
|
||||
book.url = url;
|
||||
book.origID=origId;
|
||||
library.addBook(book);
|
||||
return book.id;
|
||||
}
|
||||
|
@ -240,8 +245,8 @@ namespace kiwix {
|
|||
}
|
||||
|
||||
/* Wrapper over Manager::addBookFromPath which return a bool instead of a string */
|
||||
bool Manager::addBookFromPath(const string pathToOpen, const string pathToSave, const string url, const bool checkMetaData) {
|
||||
return !(this->addBookFromPathAndGetId(pathToOpen, pathToSave, url, checkMetaData).empty());
|
||||
bool Manager::addBookFromPath(const string pathToOpen, const string pathToSave, const string url, const string origId, const bool checkMetaData) {
|
||||
return !(this->addBookFromPathAndGetId(pathToOpen, pathToSave, url, origId, checkMetaData).empty());
|
||||
}
|
||||
|
||||
bool Manager::readBookFromPath(const string path, kiwix::Book *book) {
|
||||
|
|
|
@ -55,9 +55,9 @@ namespace kiwix {
|
|||
string getCurrentBookId();
|
||||
bool setBookIndex(const string id, const string path, const supportedIndexType type);
|
||||
bool setBookPath(const string id, const string path);
|
||||
string addBookFromPathAndGetId(const string pathToOpen, const string pathToSave = "", const string url = "",
|
||||
string addBookFromPathAndGetId(const string pathToOpen, const string pathToSave = "", const string url = "", const string origID="",
|
||||
const bool checkMetaData = false);
|
||||
bool addBookFromPath(const string pathToOpen, const string pathToSave = "", const string url = "",
|
||||
bool addBookFromPath(const string pathToOpen, const string pathToSave = "", const string url = "", const string origID="",
|
||||
const bool checkMetaData = false);
|
||||
Library cloneLibrary();
|
||||
bool getBookById(const string id, Book &book);
|
||||
|
|
Loading…
Reference in New Issue