|
|
|
|
@ -452,8 +452,8 @@ int main(int argc, char **argv) {
|
|
|
|
|
vector<string>::iterator itr;
|
|
|
|
|
kiwix::Book currentBook;
|
|
|
|
|
for ( itr = booksIds.begin(); itr != booksIds.end(); ++itr ) {
|
|
|
|
|
bool zimFileOk = false;
|
|
|
|
|
libraryManager.getBookById(*itr, currentBook);
|
|
|
|
|
string humanReadableId = currentBook.getHumanReadableIdFromPath();
|
|
|
|
|
zimPath = currentBook.pathAbsolute;
|
|
|
|
|
|
|
|
|
|
if (!zimPath.empty()) {
|
|
|
|
|
@ -463,10 +463,13 @@ int main(int argc, char **argv) {
|
|
|
|
|
kiwix::Reader *reader = NULL;
|
|
|
|
|
try {
|
|
|
|
|
reader = new kiwix::Reader(zimPath);
|
|
|
|
|
zimFileOk = true;
|
|
|
|
|
} catch (...) {
|
|
|
|
|
cerr << "Unable to open the ZIM file '" << zimPath << "'." << endl;
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (zimFileOk) {
|
|
|
|
|
string humanReadableId = currentBook.getHumanReadableIdFromPath();
|
|
|
|
|
readers[humanReadableId] = reader;
|
|
|
|
|
|
|
|
|
|
/* Instanciate the ZIM index (if necessary) */
|
|
|
|
|
@ -499,12 +502,13 @@ int main(int argc, char **argv) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Compute the Welcome HTML */
|
|
|
|
|
string welcomeBooksHtml;
|
|
|
|
|
for ( itr = booksIds.begin(); itr != booksIds.end(); ++itr ) {
|
|
|
|
|
libraryManager.getBookById(*itr, currentBook);
|
|
|
|
|
if (!currentBook.path.empty()) {
|
|
|
|
|
if (!currentBook.path.empty() && readers.find(currentBook.getHumanReadableIdFromPath()) != readers.end()) {
|
|
|
|
|
welcomeBooksHtml += "<h3><a href=\"#\">" + currentBook.title + "</a></h3> \
|
|
|
|
|
<table style=\"overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; width: 100%; \"><tr> \
|
|
|
|
|
<td style=\"background-repeat: no-repeat; background-image: url(data:" + currentBook.faviconMimeType+ ";base64," + currentBook.favicon + ")\"><div style=\"width: 50px\"/></td> \
|
|
|
|
|
|