mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #9445 (PocketBook can't always find epub cover image to create thumbnail)
This commit is contained in:
parent
c22863b2da
commit
e70550dc8a
@ -38,6 +38,11 @@ class OEBOutput(OutputFormatPlugin):
|
|||||||
except:
|
except:
|
||||||
self.log.exception('Something went wrong while trying to'
|
self.log.exception('Something went wrong while trying to'
|
||||||
' workaround Nook cover bug, ignoring')
|
' workaround Nook cover bug, ignoring')
|
||||||
|
try:
|
||||||
|
self.workaround_pocketbook_cover_bug(root)
|
||||||
|
except:
|
||||||
|
self.log.exception('Something went wrong while trying to'
|
||||||
|
' workaround Pocketbook cover bug, ignoring')
|
||||||
raw = etree.tostring(root, pretty_print=True,
|
raw = etree.tostring(root, pretty_print=True,
|
||||||
encoding='utf-8', xml_declaration=True)
|
encoding='utf-8', xml_declaration=True)
|
||||||
if key == OPF_MIME:
|
if key == OPF_MIME:
|
||||||
@ -90,3 +95,12 @@ class OEBOutput(OutputFormatPlugin):
|
|||||||
cov.set('content', 'cover')
|
cov.set('content', 'cover')
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
def workaround_pocketbook_cover_bug(self, root): # {{{
|
||||||
|
m = root.xpath('//*[local-name() = "manifest"]/*[local-name() = "item" '
|
||||||
|
' and @id="cover"]')
|
||||||
|
if len(m) == 1:
|
||||||
|
m = m[0]
|
||||||
|
p = m.getparent()
|
||||||
|
p.remove(m)
|
||||||
|
p.insert(0, m)
|
||||||
|
# }}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user