mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Fix #2680 (Failed Conversion Error)
This commit is contained in:
parent
61677b6980
commit
f5fb4d9a6c
@ -10,7 +10,7 @@ import textwrap
|
||||
|
||||
from lxml import etree
|
||||
|
||||
from calibre.ebooks.oeb.base import XPNSMAP
|
||||
from calibre.ebooks.oeb.base import XPath, XPNSMAP
|
||||
from calibre import guess_type
|
||||
|
||||
class Jacket(object):
|
||||
@ -41,10 +41,11 @@ class Jacket(object):
|
||||
''')
|
||||
|
||||
def remove_first_image(self):
|
||||
path = XPath('//h:img[@src]')
|
||||
for i, item in enumerate(self.oeb.spine):
|
||||
if i > 2: break
|
||||
for img in item.data.xpath('//h:img[@src]', namespace=XPNSMAP):
|
||||
href = item.abshref(img.get('src'))
|
||||
for img in path(item.data):
|
||||
href = item.abshref(img.get('src'))
|
||||
image = self.oeb.manifest.hrefs.get(href, None)
|
||||
if image is not None:
|
||||
self.log('Removing first image', img.get('src'))
|
||||
|
Loading…
x
Reference in New Issue
Block a user