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:
xyzzy-foo 2026-01-16 05:30:35 +09:00
parent d8f33cf65e
commit abc81de373

View File

@ -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):