From 6fb820e69a158da5ea8c04d5fb35530707199944 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 19 Dec 2013 14:37:27 +0530 Subject: [PATCH] Edit book: When edititng AZW3 files with no images in them, do not incorrectly display a number of binary records from the AZW3 file as 'unknown' miscellaneous files --- src/calibre/ebooks/oeb/polish/container.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/calibre/ebooks/oeb/polish/container.py b/src/calibre/ebooks/oeb/polish/container.py index 34cfc12179..25e757ee07 100644 --- a/src/calibre/ebooks/oeb/polish/container.py +++ b/src/calibre/ebooks/oeb/polish/container.py @@ -998,6 +998,13 @@ def do_explode(path, dest): mr = Mobi8Reader(mr, default_log) opf = os.path.abspath(mr()) obfuscated_fonts = mr.encrypted_fonts + # If there are no images then the azw3 input plugin dumps all + # binary records as .unknown images, remove them + if os.path.exists('images') and os.path.isdir('images'): + files = os.listdir('images') + unknown = [x for x in files if x.endswith('.unknown')] + if len(files) == len(unknown): + [os.remove('images/'+f) for f in files] try: os.remove('debug-raw.html') except: