From e522335424e45d4507e1b6f1915e2bb5d2cb307e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 3 Jun 2015 22:10:10 +0530 Subject: [PATCH] EPUB metadata: Fix extraction of cover image from EPUB 3 files that do not use EPUB 2 backward compatible markup and that have incorrect cover page markup as well. Fixes #1461321 [Private bug](https://bugs.launchpad.net/calibre/+bug/1461321) --- src/calibre/ebooks/metadata/opf2.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/calibre/ebooks/metadata/opf2.py b/src/calibre/ebooks/metadata/opf2.py index e2bf8c8f56..aaff457442 100644 --- a/src/calibre/ebooks/metadata/opf2.py +++ b/src/calibre/ebooks/metadata/opf2.py @@ -1176,6 +1176,12 @@ class OPF(object): # {{{ mt = item.get('media-type', '') if mt and mt.startswith('image/'): return item.get('href', None) + elif self.package_version >= 3.0: + for item in self.itermanifest(): + if item.get('properties') == 'cover-image': + mt = item.get('media-type', '') + if mt and 'xml' not in mt and 'html' not in mt: + return item.get('href', None) @dynamic_property def cover(self):