mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
postadd plugins should not be called with None book_id when a dupe is found
This commit is contained in:
parent
bd960fa84d
commit
5cc00e504a
@ -2002,17 +2002,17 @@ class Cache:
|
||||
as per the simple duplicate detection heuristic used by :meth:`has_book`.
|
||||
'''
|
||||
duplicates, ids = [], []
|
||||
fmt_map = {}
|
||||
for mi, format_map in books:
|
||||
book_id = self.create_book_entry(mi, add_duplicates=add_duplicates, apply_import_tags=apply_import_tags, preserve_uuid=preserve_uuid)
|
||||
if book_id is None:
|
||||
duplicates.append((mi, format_map))
|
||||
else:
|
||||
fmt_map = {}
|
||||
ids.append(book_id)
|
||||
for fmt, stream_or_path in iteritems(format_map):
|
||||
for fmt, stream_or_path in format_map.items():
|
||||
if self.add_format(book_id, fmt, stream_or_path, dbapi=dbapi, run_hooks=run_hooks):
|
||||
fmt_map[fmt.lower()] = getattr(stream_or_path, 'name', stream_or_path) or '<stream>'
|
||||
run_plugins_on_postadd(dbapi or self, book_id, fmt_map)
|
||||
run_plugins_on_postadd(dbapi or self, book_id, fmt_map)
|
||||
return ids, duplicates
|
||||
|
||||
@write_api
|
||||
|
Loading…
x
Reference in New Issue
Block a user