mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Make ignore_errors also work for setting covers
This commit is contained in:
parent
2fd8022e9e
commit
47b927f5bc
@ -1085,14 +1085,18 @@ class Cache(object):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
# force_changes has no effect on cover manipulation
|
# force_changes has no effect on cover manipulation
|
||||||
cdata = mi.cover_data[1]
|
try:
|
||||||
if cdata is None and isinstance(mi.cover, basestring) and mi.cover and os.access(mi.cover, os.R_OK):
|
cdata = mi.cover_data[1]
|
||||||
with lopen(mi.cover, 'rb') as f:
|
if cdata is None and isinstance(mi.cover, basestring) and mi.cover and os.access(mi.cover, os.R_OK):
|
||||||
raw = f.read()
|
with lopen(mi.cover, 'rb') as f:
|
||||||
if raw:
|
cdata = f.read() or None
|
||||||
cdata = raw
|
if cdata is not None:
|
||||||
if cdata is not None:
|
self._set_cover({book_id: cdata})
|
||||||
self._set_cover({book_id: cdata})
|
except:
|
||||||
|
if ignore_errors:
|
||||||
|
traceback.print_exc()
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with self.backend.conn: # Speed up set_metadata by not operating in autocommit mode
|
with self.backend.conn: # Speed up set_metadata by not operating in autocommit mode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user