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

This commit is contained in:
Kovid Goyal 2013-12-19 14:37:27 +05:30
parent 531a8369cd
commit 6fb820e69a

View File

@ -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: