mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Fix marking image as cover not working for AZW3 files if the file did not previously have a cover
This commit is contained in:
parent
29237ad857
commit
531a8369cd
@ -40,8 +40,14 @@ def get_azw3_raster_cover_name(container):
|
|||||||
|
|
||||||
def mark_as_cover_azw3(container, name):
|
def mark_as_cover_azw3(container, name):
|
||||||
href = container.name_to_href(name, container.opf_name)
|
href = container.name_to_href(name, container.opf_name)
|
||||||
|
found = False
|
||||||
for item in container.opf_xpath('//opf:guide/opf:reference[@href and contains(@type, "cover")]'):
|
for item in container.opf_xpath('//opf:guide/opf:reference[@href and contains(@type, "cover")]'):
|
||||||
item.set('href', href)
|
item.set('href', href)
|
||||||
|
found = True
|
||||||
|
if not found:
|
||||||
|
for guide in container.opf_xpath('//opf:guide'):
|
||||||
|
container.insert_into_xml(guide, guide.makeelement(
|
||||||
|
OPF('reference'), href=href, type='cover'))
|
||||||
container.dirty(container.opf_name)
|
container.dirty(container.opf_name)
|
||||||
|
|
||||||
def get_raster_cover_name(container):
|
def get_raster_cover_name(container):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user