From 15b6c4f8b228eb44e8866748885de65d6acb51ae Mon Sep 17 00:00:00 2001 From: kelson42 Date: Sat, 22 Jun 2013 00:39:10 +0200 Subject: [PATCH] + move "intelligent" getTitle() code from library.cpp to reader.cpp --- src/common/kiwix/manager.cpp | 6 ------ src/common/kiwix/reader.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/kiwix/manager.cpp b/src/common/kiwix/manager.cpp index adbcd20f0..9b8e17a05 100644 --- a/src/common/kiwix/manager.cpp +++ b/src/common/kiwix/manager.cpp @@ -254,12 +254,6 @@ namespace kiwix { book.creator = reader->getCreator(); 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; articleCountStream << reader->getArticleCount(); diff --git a/src/common/kiwix/reader.cpp b/src/common/kiwix/reader.cpp index 3262311b1..4f7e2d071 100644 --- a/src/common/kiwix/reader.cpp +++ b/src/common/kiwix/reader.cpp @@ -245,6 +245,12 @@ namespace kiwix { string Reader::getTitle() { string value; this->getMetatag("Title", value); + if (value.empty()) { + value = getLastPathElement(zimFileHandler->getFilename()); + std::replace(value.begin(), value.end(), '_', ' '); + size_t pos = value.find(".zim"); + value = value.substr(0, pos); + } return value; }