Device drivers: Ignore corrupted metadata.calibre, instead of raising an error

This commit is contained in:
Kovid Goyal 2012-09-05 09:28:06 +05:30
parent 6ec107a928
commit 206af4c041
2 changed files with 4 additions and 2 deletions

View File

@ -166,7 +166,7 @@ class USBMS(CLI, Device):
# make a dict cache of paths so the lookup in the loop below is faster.
bl_cache = {}
for idx,b in enumerate(bl):
for idx, b in enumerate(bl):
bl_cache[b.lpath] = idx
all_formats = self.formats_to_scan_for()

View File

@ -161,7 +161,9 @@ class JsonCodec(object):
try:
js = json.load(file_, encoding='utf-8')
for item in js:
booklist.append(self.raw_to_book(item, book_class, prefix))
entry = self.raw_to_book(item, book_class, prefix)
if entry is not None:
booklist.append(entry)
except:
print 'exception during JSON decode_from_file'
traceback.print_exc()