Store the downloadId in the book (and in the library).

This commit is contained in:
Matthieu Gautier 2018-10-16 17:53:18 +02:00
parent 43ff8565d1
commit fe6d5fa93e
3 changed files with 10 additions and 0 deletions

View File

@ -69,6 +69,7 @@ class Book
const uint64_t& getSize() const { return m_size; }
const std::string& getFavicon() const { return m_favicon; }
const std::string& getFaviconMimeType() const { return m_faviconMimeType; }
const std::string& getDownloadId() const { return m_downloadId; }
void setReadOnly(bool readOnly) { m_readOnly = readOnly; }
void setId(const std::string& id) { m_id = id; }
@ -91,9 +92,11 @@ class Book
void setSize(uint64_t size) { m_size = size; }
void setFavicon(const std::string& favicon) { m_favicon = favicon; }
void setFaviconMimeType(const std::string& faviconMimeType) { m_faviconMimeType = faviconMimeType; }
void setDownloadId(const std::string& downloadId) { m_downloadId = downloadId; }
protected:
std::string m_id;
std::string m_downloadId;
std::string m_path;
bool m_pathValid;
std::string m_indexPath;

View File

@ -123,6 +123,9 @@ void Book::updateFromXml(const pugi::xml_node& node, const std::string& baseDir)
m_size = strtoull(ATTR("size"), 0, 0);
m_favicon = base64_decode(ATTR("favicon"));
m_faviconMimeType = ATTR("faviconMimeType");
try {
m_downloadId = ATTR("downloadId");
} catch(...) {}
}
#undef ATTR

View File

@ -155,6 +155,10 @@ bool Library::writeToFile(const std::string& path) {
if (!book.getSize()) {
bookNode.append_attribute("size") = to_string(book.getSize()).c_str();
}
if (!book.getDownloadId().empty()) {
bookNode.append_attribute("downloadId") = book.getDownloadId().c_str();
}
}
}