bool FB2Plugin::readModel(const BookDescription &description, BookModel &model) const { // this code fixes incorrect config entry created by fbreader of version <= 0.6.1 // makes no sense if old fbreader was not used if (description.encoding() != "auto") { BookInfo(description.fileName()).EncodingOption.setValue("auto"); } return FB2BookReader(model).readBook(description.fileName()); }
void BookDescriptionUtil::resetZipInfo(const ZLFile &zipFile) { ZLOption::clearGroup(zipFile.path()); shared_ptr<ZLDir> zipDir = zipFile.directory(); if (!zipDir.isNull()) { std::string zipPrefix = zipFile.path() + ':'; std::vector<std::string> entries; int counter = 0; zipDir->collectFiles(entries, false); for (std::vector<std::string>::iterator zit = entries.begin(); zit != entries.end(); ++zit) { std::string optionName = ENTRY; ZLStringUtil::appendNumber(optionName, counter); std::string fullName = zipPrefix + *zit; ZLStringOption(FBCategoryKey::BOOKS, zipFile.path(), optionName, "").setValue(fullName); BookInfo(fullName).reset(); ++counter; } ZLIntegerOption(FBCategoryKey::BOOKS, zipFile.path(), ENTRIES_NUMBER, -1).setValue(counter); } }