mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-03-16 14:39:17 -04:00
OPF2: Backport the fallback process for reading Open Manga Format (OMF) cover images to OPF2
The OMF cover image was not referenced in the KEPUB conversion because the EPUB Input plugin references OPF2 instead of OPF3.
This commit is contained in:
parent
d8f33cf65e
commit
abc81de373
@ -1224,6 +1224,15 @@ class OPF: # {{{
|
||||
mt = item.get('media-type', '')
|
||||
if mt and 'xml' not in mt and 'html' not in mt:
|
||||
return item.get('href', None)
|
||||
# OMF files have the cover as the first item in the spine
|
||||
first_ref = self.first_spine_item()
|
||||
if first_ref:
|
||||
for item in self.itermanifest():
|
||||
if item.get('href') == first_ref:
|
||||
mt = item.get('media-type', '')
|
||||
if mt and mt.lower() in {'image/jpeg', 'image/jpg', 'image/png', 'image/webp'}:
|
||||
return first_ref
|
||||
break
|
||||
|
||||
@property
|
||||
def raster_cover(self):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user