示例#1
0
bool HtmlPlugin::readMetaInfo(Book &book) const {
	shared_ptr<ZLInputStream> stream = book.file().inputStream();
	if (stream.isNull()) {
		return false;
	}

	shared_ptr<ZLInputStream> htmlStream = new HtmlReaderStream(stream, 50000);
	detectEncodingAndLanguage(book, *htmlStream);
	if (book.encoding().empty()) {
		return false;
	}
	HtmlDescriptionReader(book).readDocument(*stream);

	return true;
}
示例#2
0
bool HtmlPlugin::readDescription(const std::string &path, BookDescription &description) const {
	ZLFile file(path);
	shared_ptr<ZLInputStream> stream = file.inputStream();
	if (stream.isNull()) {
		return false;
	}

	detectEncodingAndLanguage(description, *stream);
	if (description.encoding().empty()) {
		return false;
	}
	HtmlDescriptionReader(description).readDocument(*stream);
	defaultTitle(description, file.name());

	return true;
}