From 6a724d931f9856ce89396c8488cfd2d3811cc95f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 12 Jul 2013 11:10:35 +0530 Subject: [PATCH] ... --- src/calibre/db/legacy.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/calibre/db/legacy.py b/src/calibre/db/legacy.py index e1e533266f..54d0887954 100644 --- a/src/calibre/db/legacy.py +++ b/src/calibre/db/legacy.py @@ -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]) # }}}