mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Remove the useless exclude_cover parameter from EbookIterator
This commit is contained in:
parent
3494e09604
commit
20a1857704
@ -49,9 +49,8 @@ class EbookIterator(BookmarksMixin):
|
||||
|
||||
CHARACTERS_PER_PAGE = 1000
|
||||
|
||||
def __init__(self, pathtoebook, log=None, exclude_cover=False):
|
||||
def __init__(self, pathtoebook, log=None):
|
||||
self.log = log or default_log
|
||||
self.exclude_cover = exclude_cover
|
||||
pathtoebook = pathtoebook.strip()
|
||||
self.pathtoebook = os.path.abspath(pathtoebook)
|
||||
self.config = DynamicConfig(name='iterator')
|
||||
@ -143,23 +142,16 @@ class EbookIterator(BookmarksMixin):
|
||||
self.log.warn('Missing spine item:', repr(spath))
|
||||
|
||||
cover = self.opf.cover
|
||||
if cover:
|
||||
if not self.exclude_cover and self.ebook_ext in {
|
||||
'lit', 'mobi', 'prc', 'opf', 'fb2', 'azw', 'azw3'}:
|
||||
cfile = os.path.join(self.base, 'calibre_iterator_cover.html')
|
||||
rcpath = os.path.relpath(cover, self.base).replace(os.sep, '/')
|
||||
chtml = (TITLEPAGE%prepare_string_for_xml(rcpath, True)).encode('utf-8')
|
||||
with open(cfile, 'wb') as f:
|
||||
f.write(chtml)
|
||||
self.spine[0:0] = [Spiny(cfile,
|
||||
mime_type='application/xhtml+xml')]
|
||||
self.delete_on_exit.append(cfile)
|
||||
elif self.exclude_cover and self.ebook_ext == 'epub':
|
||||
try:
|
||||
if (len(self.spine) > 1 and self.spine.index(cover) == 0):
|
||||
self.spine = self.spine[1:]
|
||||
except ValueError:
|
||||
pass
|
||||
if cover and self.ebook_ext in {'lit', 'mobi', 'prc', 'opf', 'fb2',
|
||||
'azw', 'azw3'}:
|
||||
cfile = os.path.join(self.base, 'calibre_iterator_cover.html')
|
||||
rcpath = os.path.relpath(cover, self.base).replace(os.sep, '/')
|
||||
chtml = (TITLEPAGE%prepare_string_for_xml(rcpath, True)).encode('utf-8')
|
||||
with open(cfile, 'wb') as f:
|
||||
f.write(chtml)
|
||||
self.spine[0:0] = [Spiny(cfile,
|
||||
mime_type='application/xhtml+xml')]
|
||||
self.delete_on_exit.append(cfile)
|
||||
|
||||
if self.opf.path_to_html_toc is not None and \
|
||||
self.opf.path_to_html_toc not in self.spine:
|
||||
|
Loading…
x
Reference in New Issue
Block a user