+ compute "default" title if not specified in the ZIM file metadata

This commit is contained in:
kelson42 2012-04-02 19:52:19 +00:00
parent 2ae7112a32
commit 9ead81ca0c
1 changed files with 8 additions and 1 deletions

View File

@ -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();