From 1e1327c3ef6f9dfdff6cd79cd985696acb80f6cb Mon Sep 17 00:00:00 2001 From: KK Date: Sat, 1 Oct 2016 19:38:04 +0800 Subject: [PATCH] Fix content.opf's --- epub.py | 15 ++++----------- novel.py | 2 +- novel_360dxs.py | 2 +- novel_wenku8.py | 2 +- templates/content.opf | 2 +- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/epub.py b/epub.py index 72819aa..b85bf5a 100644 --- a/epub.py +++ b/epub.py @@ -46,16 +46,7 @@ def __init__(self, output_dir=None, cover_path=None, single_thread=False, out_fo self.out_format = out_format self.uuid = str(uuid.uuid1()) - self.chapters = kwargs['chapters'] - self.volume_name = kwargs['volume_name'] - self.volume_number = kwargs['volume_number'] - self.author = kwargs['author'] - self.illustrator = kwargs['illustrator'] - self.introduction = kwargs['introduction'] - self.cover_url = kwargs['cover_url'] - self.book_name = kwargs['book_name'] - self.filename = kwargs['filename'] - self.date = kwargs['date'] + self.__dict__.update(kwargs) self.base_path = '' self.pictures = [] self.generated_file = '' @@ -241,7 +232,9 @@ def create_content_opf_xml(self): final_content_opf_xml = content_opf_xml.format(book_name=html.escape(self.book_name), volume_number=self.volume_number, uuid=self.uuid, - cover_name='img' + cover_name, date=self.date, + cover_name='img' + cover_name, + source=self.source, + date=self.date, introduction=html.escape(self.introduction), author=self.author, file_paths='\n'.join(file_paths), diff --git a/novel.py b/novel.py index 11508ee..297967a 100644 --- a/novel.py +++ b/novel.py @@ -75,6 +75,6 @@ def get_novel_information(self): Return: A list contains dict, dict usually has these information: volume_name, volume_number, book_name, - author, illustrator, introduction, chapters, cover_url, date + author, illustrator, introduction, chapters, cover_url, date, source """ pass diff --git a/novel_360dxs.py b/novel_360dxs.py index fb5f325..95fce4e 100644 --- a/novel_360dxs.py +++ b/novel_360dxs.py @@ -125,7 +125,7 @@ def parse_book(self, tag): {'chapters': self.chapters, 'volume_name': self.volume_name, 'volume_number': self.volume_number, 'book_name': self.book_name, 'filename': self.filename, 'author': self.author, 'illustrator': self.illustrator, 'introduction': self.introduction, - 'cover_url': self.cover_url, 'date': self.date}) + 'cover_url': self.cover_url, 'date': self.date, 'source': self.url}) self.chapters = [] self.chapter_links = [] diff --git a/novel_wenku8.py b/novel_wenku8.py index 6945fe0..21cded6 100644 --- a/novel_wenku8.py +++ b/novel_wenku8.py @@ -124,7 +124,7 @@ def parse_book(self, volume_title, urls): {'chapters': self.chapters, 'volume_name': self.volume_name, 'volume_number': self.volume_number, 'book_name': self.book_name, 'filename': self.filename, 'author': self.author, 'illustrator': self.illustrator, 'introduction': self.introduction, - 'cover_url': self.cover_url, 'date': self.date}) + 'cover_url': self.cover_url, 'date': self.date, 'source': self.url}) self.chapters = [] self.chapter_links = [] diff --git a/templates/content.opf b/templates/content.opf index 989ed33..84d27d2 100644 --- a/templates/content.opf +++ b/templates/content.opf @@ -5,7 +5,7 @@ {book_name} {volume_number} {author} zh - http://www.lightnovel.cn + {source} {introduction} {date} linovel