mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
296eda53ea
commit
19d4a453e8
@ -101,7 +101,7 @@ def extract_calibre_cover(raw, base, log):
|
|||||||
soup = BeautifulSoup(raw)
|
soup = BeautifulSoup(raw)
|
||||||
matches = soup.find(name=['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'span',
|
matches = soup.find(name=['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'span',
|
||||||
'font', 'br'])
|
'font', 'br'])
|
||||||
images = soup.findAll('img')
|
images = soup.findAll('img', src=True)
|
||||||
if matches is None and len(images) == 1 and \
|
if matches is None and len(images) == 1 and \
|
||||||
images[0].get('alt', '').lower()=='cover':
|
images[0].get('alt', '').lower()=='cover':
|
||||||
img = images[0]
|
img = images[0]
|
||||||
@ -119,7 +119,7 @@ def extract_calibre_cover(raw, base, log):
|
|||||||
# Body has text, abort
|
# Body has text, abort
|
||||||
return
|
return
|
||||||
images = body.findAll('img', src=True)
|
images = body.findAll('img', src=True)
|
||||||
if 0 < len(images) < 2:
|
if len(images) == 1:
|
||||||
img = os.path.join(base, *images[0]['src'].split('/'))
|
img = os.path.join(base, *images[0]['src'].split('/'))
|
||||||
return return_raster_image(img)
|
return return_raster_image(img)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user