From a22f07701801618e725cddb32a8048aa1a357a66 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Feb 2013 09:38:47 +0530 Subject: [PATCH] Fix jacket detection in azw3 --- src/calibre/ebooks/oeb/polish/jacket.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/oeb/polish/jacket.py b/src/calibre/ebooks/oeb/polish/jacket.py index b6286830a4..8ae65f3f9f 100644 --- a/src/calibre/ebooks/oeb/polish/jacket.py +++ b/src/calibre/ebooks/oeb/polish/jacket.py @@ -31,10 +31,15 @@ def is_current_jacket(root): def find_existing_jacket(container): for item in container.spine_items: name = container.abspath_to_name(item) - if name.rpartition('/')[-1].startswith('jacket') and name.endswith('.xhtml'): + if container.book_type == 'azw3': root = container.parsed(name) - if is_current_jacket(root) or is_legacy_jacket(root): + if is_current_jacket(root): return name + else: + if name.rpartition('/')[-1].startswith('jacket') and name.endswith('.xhtml'): + root = container.parsed(name) + if is_current_jacket(root) or is_legacy_jacket(root): + return name def replace_jacket(container, name): root = render_jacket(container.mi)