mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Conversion pipeline: Handle guide elements with incorrectly cased hrefs. Also handle guide elements of type coverimagestandard and thumbimagestandard.
This commit is contained in:
parent
a3a984386a
commit
47896643ae
@ -338,8 +338,15 @@ class OEBReader(object):
|
|||||||
href = elem.get('href')
|
href = elem.get('href')
|
||||||
path = urlnormalize(urldefrag(href)[0])
|
path = urlnormalize(urldefrag(href)[0])
|
||||||
if path not in manifest.hrefs:
|
if path not in manifest.hrefs:
|
||||||
self.logger.warn(u'Guide reference %r not found' % href)
|
corrected_href = None
|
||||||
continue
|
for href in manifest.hrefs:
|
||||||
|
if href.lower() == path.lower():
|
||||||
|
corrected_href = href
|
||||||
|
break
|
||||||
|
if corrected_href is None:
|
||||||
|
self.logger.warn(u'Guide reference %r not found' % href)
|
||||||
|
continue
|
||||||
|
href = corrected_href
|
||||||
guide.add(elem.get('type'), elem.get('title'), href)
|
guide.add(elem.get('type'), elem.get('title'), href)
|
||||||
|
|
||||||
def _find_ncx(self, opf):
|
def _find_ncx(self, opf):
|
||||||
|
@ -15,10 +15,10 @@ class Clean(object):
|
|||||||
|
|
||||||
if 'cover' not in self.oeb.guide:
|
if 'cover' not in self.oeb.guide:
|
||||||
covers = []
|
covers = []
|
||||||
for x in ('other.ms-coverimage-standard',
|
for x in ('other.ms-coverimage-standard', 'coverimagestandard',
|
||||||
'other.ms-titleimage-standard', 'other.ms-titleimage',
|
'other.ms-titleimage-standard', 'other.ms-titleimage',
|
||||||
'other.ms-coverimage', 'other.ms-thumbimage-standard',
|
'other.ms-coverimage', 'other.ms-thumbimage-standard',
|
||||||
'other.ms-thumbimage'):
|
'other.ms-thumbimage', 'thumbimagestandard'):
|
||||||
if x in self.oeb.guide:
|
if x in self.oeb.guide:
|
||||||
href = self.oeb.guide[x].href
|
href = self.oeb.guide[x].href
|
||||||
item = self.oeb.manifest.hrefs[href]
|
item = self.oeb.manifest.hrefs[href]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user