mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Catalog generation: Do not crash is a book in the library has no uuid. Fixes #1565242 [Generate catalog fails](https://bugs.launchpad.net/calibre/+bug/1565242)
This commit is contained in:
parent
a951180190
commit
0a5d6a3bf4
@ -4341,16 +4341,18 @@ class CatalogBuilder(object):
|
||||
cover_crc = hex(zlib.crc32(data))
|
||||
|
||||
# Test cache for uuid
|
||||
uuid = title.get('uuid')
|
||||
if uuid:
|
||||
zf = _open_archive()
|
||||
if zf is not None:
|
||||
with zf:
|
||||
try:
|
||||
zf.getinfo(title['uuid'] + cover_crc)
|
||||
zf.getinfo(uuid + cover_crc)
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
# uuid found in cache with matching crc
|
||||
thumb_data = zf.read(title['uuid'] + cover_crc)
|
||||
thumb_data = zf.read(uuid + cover_crc)
|
||||
with open(os.path.join(image_dir, thumb_file), 'wb') as f:
|
||||
f.write(thumb_data)
|
||||
return
|
||||
@ -4369,7 +4371,7 @@ class CatalogBuilder(object):
|
||||
zf = _open_archive('a')
|
||||
if zf is not None:
|
||||
with zf:
|
||||
zf.writestr(title['uuid'] + cover_crc, thumb_data)
|
||||
zf.writestr(uuid + cover_crc, thumb_data)
|
||||
|
||||
def generate_thumbnails(self):
|
||||
""" Generate a thumbnail cover for each book.
|
||||
|
Loading…
x
Reference in New Issue
Block a user