1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-25 02:57:22 +00:00

Bugfix for already present mobi file during convert (fixes #1900)

This commit is contained in:
Ozzie Isaacs 2022-02-06 18:57:58 +01:00
parent 0c3c0c0664
commit 3bb41aca6d

View File

@ -116,8 +116,20 @@ class TaskConvert(CalibreTask):
log.info("Book id %d already converted to %s", book_id, format_new_ext) log.info("Book id %d already converted to %s", book_id, format_new_ext)
cur_book = local_db.get_book(book_id) cur_book = local_db.get_book(book_id)
self.title = cur_book.title self.title = cur_book.title
self.results['path'] = file_path self.results['path'] = cur_book.path
self.results['title'] = self.title self.results['title'] = self.title
new_format = db.Data(name=os.path.basename(file_path),
book_format=self.settings['new_book_format'].upper(),
book=book_id, uncompressed_size=os.path.getsize(file_path + format_new_ext))
try:
local_db.session.merge(new_format)
local_db.session.commit()
except SQLAlchemyError as e:
local_db.session.rollback()
log.error("Database error: %s", e)
local_db.session.close()
self._handleError(error_message)
return
self._handleSuccess() self._handleSuccess()
local_db.session.close() local_db.session.close()
return os.path.basename(file_path + format_new_ext) return os.path.basename(file_path + format_new_ext)