mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
...
This commit is contained in:
parent
4a2a4a54d4
commit
6a724d931f
@ -217,12 +217,22 @@ 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.data.index_to_id(index)
|
||||
return self.new_api.add_format(book_id, fmt, stream, replace=replace, run_hooks=False, dbapi=self)
|
||||
try:
|
||||
return self.new_api.add_format(book_id, fmt, stream, replace=replace, run_hooks=False, dbapi=self)
|
||||
except:
|
||||
raise
|
||||
else:
|
||||
self.notify('metadata', [book_id])
|
||||
|
||||
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.data.index_to_id(index)
|
||||
return self.new_api.add_format(book_id, fmt, fpath, replace=replace, run_hooks=True, dbapi=self)
|
||||
try:
|
||||
return self.new_api.add_format(book_id, fmt, fpath, replace=replace, run_hooks=True, dbapi=self)
|
||||
except:
|
||||
raise
|
||||
else:
|
||||
self.notify('metadata', [book_id])
|
||||
|
||||
# }}}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user