From 1400f54107185d80ea880bc786de78910a382e48 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 4 May 2011 11:02:56 -0600 Subject: [PATCH] EPUB metadata: When extracting covers from epub files handle invalid epubs that specify their content as a raster cover. Apparently PG produces these. --- src/calibre/ebooks/metadata/opf2.py | 4 +++- src/calibre/gui2/actions/choose_library.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/metadata/opf2.py b/src/calibre/ebooks/metadata/opf2.py index 58c887bfdb..1d91236757 100644 --- a/src/calibre/ebooks/metadata/opf2.py +++ b/src/calibre/ebooks/metadata/opf2.py @@ -966,7 +966,9 @@ class OPF(object): # {{{ cover_id = covers[0].get('content') for item in self.itermanifest(): if item.get('id', None) == cover_id: - return item.get('href', None) + mt = item.get('media-type', '') + if 'xml' not in mt: + return item.get('href', None) @dynamic_property def cover(self): diff --git a/src/calibre/gui2/actions/choose_library.py b/src/calibre/gui2/actions/choose_library.py index 4b262ad9dd..a663f288af 100644 --- a/src/calibre/gui2/actions/choose_library.py +++ b/src/calibre/gui2/actions/choose_library.py @@ -246,7 +246,7 @@ class ChooseLibraryAction(InterfaceAction): def delete_requested(self, name, location): loc = location.replace('/', os.sep) if not question_dialog(self.gui, _('Are you sure?'), '

'+ - _('All files from %s will be ' + _('All files from %s will be ' 'permanently deleted. Are you sure?') % loc, show_copy_button=False): return