This commit is contained in:
Kovid Goyal 2015-03-29 08:14:26 +05:30
parent ccf54606be
commit 1c945b2d19

View File

@ -183,11 +183,13 @@ class AddAction(InterfaceAction):
from calibre.ebooks.oeb.polish.create import create_book from calibre.ebooks.oeb.polish.create import create_book
pt = PersistentTemporaryFile(suffix='.' + format_) pt = PersistentTemporaryFile(suffix='.' + format_)
pt.close() pt.close()
mi = db.new_api.get_metadata(id_, get_cover=False, try:
get_user_categories=False, cover_as_data=False) mi = db.new_api.get_metadata(id_, get_cover=False,
create_book(mi, pt.name, fmt=format_) get_user_categories=False, cover_as_data=False)
db.add_format_with_hooks(id_, format_, pt.name, index_is_id=True, notify=True) create_book(mi, pt.name, fmt=format_)
os.remove(pt.name) db.add_format_with_hooks(id_, format_, pt.name, index_is_id=True, notify=True)
finally:
os.remove(pt.name)
current_idx = self.gui.library_view.currentIndex() current_idx = self.gui.library_view.currentIndex()
if current_idx.isValid(): if current_idx.isValid():