mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-29 19:33:14 +02:00
Don't print out error messages when no cache is present on a device
This commit is contained in:
parent
78bb3a2753
commit
38b1f35ff7
1 changed files with 16 additions and 12 deletions
|
|
@ -277,18 +277,22 @@ def parse_metadata_cache(cls, prefix, name):
|
|||
bl = []
|
||||
js = []
|
||||
need_sync = False
|
||||
try:
|
||||
with open(cls.normalize_path(os.path.join(prefix, name)), 'rb') as f:
|
||||
js = json.load(f, encoding='utf-8')
|
||||
for item in js:
|
||||
book = cls.book_class(prefix, item.get('lpath', None))
|
||||
for key in item.keys():
|
||||
setattr(book, key, item[key])
|
||||
bl.append(book)
|
||||
except:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
bl = []
|
||||
cache_file = cls.normalize_path(os.path.join(prefix, name))
|
||||
if os.access(cache_file, os.R_OK):
|
||||
try:
|
||||
with open(cache_file, 'rb') as f:
|
||||
js = json.load(f, encoding='utf-8')
|
||||
for item in js:
|
||||
book = cls.book_class(prefix, item.get('lpath', None))
|
||||
for key in item.keys():
|
||||
setattr(book, key, item[key])
|
||||
bl.append(book)
|
||||
except:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
bl = []
|
||||
need_sync = True
|
||||
else:
|
||||
need_sync = True
|
||||
return bl, need_sync
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue