Fix jacket detection in azw3

This commit is contained in:
Kovid Goyal 2013-02-15 09:38:47 +05:30
parent 29a45f9670
commit a22f077018

View File

@ -31,10 +31,15 @@ def is_current_jacket(root):
def find_existing_jacket(container): def find_existing_jacket(container):
for item in container.spine_items: for item in container.spine_items:
name = container.abspath_to_name(item) 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) root = container.parsed(name)
if is_current_jacket(root) or is_legacy_jacket(root): if is_current_jacket(root):
return name 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): def replace_jacket(container, name):
root = render_jacket(container.mi) root = render_jacket(container.mi)