mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
5ff3b9e811
commit
68959f7652
@ -148,7 +148,6 @@ class OEBReader(object):
|
|||||||
if not has_aut:
|
if not has_aut:
|
||||||
m.add('creator', self.oeb.translate(__('Unknown')), role='aut')
|
m.add('creator', self.oeb.translate(__('Unknown')), role='aut')
|
||||||
|
|
||||||
|
|
||||||
def _manifest_prune_invalid(self):
|
def _manifest_prune_invalid(self):
|
||||||
'''
|
'''
|
||||||
Remove items from manifest that contain invalid data. This prevents
|
Remove items from manifest that contain invalid data. This prevents
|
||||||
@ -497,7 +496,8 @@ class OEBReader(object):
|
|||||||
titles = []
|
titles = []
|
||||||
headers = []
|
headers = []
|
||||||
for item in self.oeb.spine:
|
for item in self.oeb.spine:
|
||||||
if not item.linear: continue
|
if not item.linear:
|
||||||
|
continue
|
||||||
html = item.data
|
html = item.data
|
||||||
title = ''.join(xpath(html, '/h:html/h:head/h:title/text()'))
|
title = ''.join(xpath(html, '/h:html/h:head/h:title/text()'))
|
||||||
title = COLLAPSE_RE.sub(' ', title.strip())
|
title = COLLAPSE_RE.sub(' ', title.strip())
|
||||||
@ -515,17 +515,21 @@ class OEBReader(object):
|
|||||||
if len(titles) > len(set(titles)):
|
if len(titles) > len(set(titles)):
|
||||||
use = headers
|
use = headers
|
||||||
for title, item in izip(use, self.oeb.spine):
|
for title, item in izip(use, self.oeb.spine):
|
||||||
if not item.linear: continue
|
if not item.linear:
|
||||||
|
continue
|
||||||
toc.add(title, item.href)
|
toc.add(title, item.href)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _toc_from_opf(self, opf, item):
|
def _toc_from_opf(self, opf, item):
|
||||||
self.oeb.auto_generated_toc = False
|
self.oeb.auto_generated_toc = False
|
||||||
if self._toc_from_ncx(item): return
|
if self._toc_from_ncx(item):
|
||||||
|
return
|
||||||
# Prefer HTML to tour based TOC, since several LIT files
|
# Prefer HTML to tour based TOC, since several LIT files
|
||||||
# have good HTML TOCs but bad tour based TOCs
|
# have good HTML TOCs but bad tour based TOCs
|
||||||
if self._toc_from_html(opf): return
|
if self._toc_from_html(opf):
|
||||||
if self._toc_from_tour(opf): return
|
return
|
||||||
|
if self._toc_from_tour(opf):
|
||||||
|
return
|
||||||
self._toc_from_spine(opf)
|
self._toc_from_spine(opf)
|
||||||
self.oeb.auto_generated_toc = True
|
self.oeb.auto_generated_toc = True
|
||||||
|
|
||||||
@ -589,8 +593,10 @@ class OEBReader(object):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def _pages_from_opf(self, opf, item):
|
def _pages_from_opf(self, opf, item):
|
||||||
if self._pages_from_ncx(opf, item): return
|
if self._pages_from_ncx(opf, item):
|
||||||
if self._pages_from_page_map(opf): return
|
return
|
||||||
|
if self._pages_from_page_map(opf):
|
||||||
|
return
|
||||||
return
|
return
|
||||||
|
|
||||||
def _cover_from_html(self, hcover):
|
def _cover_from_html(self, hcover):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user