mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Fix unreachable call to notify() when adding formats with the legacy API
This commit is contained in:
parent
d8431538a1
commit
7761f537e6
@ -275,22 +275,16 @@ class LibraryDatabase(object):
|
||||
def add_format(self, index, fmt, stream, index_is_id=False, path=None, notify=True, replace=True, copy_function=None):
|
||||
''' path and copy_function are ignored by the new API '''
|
||||
book_id = index if index_is_id else self.id(index)
|
||||
try:
|
||||
return self.new_api.add_format(book_id, fmt, stream, replace=replace, run_hooks=False, dbapi=self)
|
||||
except:
|
||||
raise
|
||||
else:
|
||||
ret = self.new_api.add_format(book_id, fmt, stream, replace=replace, run_hooks=False, dbapi=self)
|
||||
self.notify('metadata', [book_id])
|
||||
return ret
|
||||
|
||||
def add_format_with_hooks(self, index, fmt, fpath, index_is_id=False, path=None, notify=True, replace=True):
|
||||
''' path is ignored by the new API '''
|
||||
book_id = index if index_is_id else self.id(index)
|
||||
try:
|
||||
return self.new_api.add_format(book_id, fmt, fpath, replace=replace, run_hooks=True, dbapi=self)
|
||||
except:
|
||||
raise
|
||||
else:
|
||||
ret = self.new_api.add_format(book_id, fmt, fpath, replace=replace, run_hooks=True, dbapi=self)
|
||||
self.notify('metadata', [book_id])
|
||||
return ret
|
||||
|
||||
# }}}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user