mirror of https://github.com/kiwix/libkiwix.git
+ compute "default" title if not specified in the ZIM file metadata
This commit is contained in:
parent
2ae7112a32
commit
9ead81ca0c
|
@ -242,13 +242,20 @@ namespace kiwix {
|
||||||
book.path = path;
|
book.path = path;
|
||||||
book.pathAbsolute = path;
|
book.pathAbsolute = path;
|
||||||
book.id = reader.getId();
|
book.id = reader.getId();
|
||||||
book.title = reader.getTitle();
|
|
||||||
book.description = reader.getDescription();
|
book.description = reader.getDescription();
|
||||||
book.language = reader.getLanguage();
|
book.language = reader.getLanguage();
|
||||||
book.date = reader.getDate();
|
book.date = reader.getDate();
|
||||||
book.creator = reader.getCreator();
|
book.creator = reader.getCreator();
|
||||||
book.publisher = reader.getPublisher();
|
book.publisher = reader.getPublisher();
|
||||||
|
|
||||||
|
book.title = reader.getTitle();
|
||||||
|
if (book.title.empty()) {
|
||||||
|
book.title = getLastPathElement(path);
|
||||||
|
std::replace(book.title.begin(), book.title.end(), '_', ' ');
|
||||||
|
size_t pos = book.title.find(".zim");
|
||||||
|
book.title = book.title.substr(0, pos);
|
||||||
|
}
|
||||||
|
|
||||||
std::ostringstream articleCountStream;
|
std::ostringstream articleCountStream;
|
||||||
articleCountStream << reader.getArticleCount();
|
articleCountStream << reader.getArticleCount();
|
||||||
book.articleCount = articleCountStream.str();
|
book.articleCount = articleCountStream.str();
|
||||||
|
|
Loading…
Reference in New Issue