|
|
@ -303,27 +303,29 @@ class WorkerThread(threading.Thread):
|
|
|
|
if (check < 2 and web.ub.config.config_ebookconverter == 1) or \
|
|
|
|
if (check < 2 and web.ub.config.config_ebookconverter == 1) or \
|
|
|
|
(check == 0 and web.ub.config.config_ebookconverter == 2):
|
|
|
|
(check == 0 and web.ub.config.config_ebookconverter == 2):
|
|
|
|
cur_book = web.db.session.query(web.db.Books).filter(web.db.Books.id == bookid).first()
|
|
|
|
cur_book = web.db.session.query(web.db.Books).filter(web.db.Books.id == bookid).first()
|
|
|
|
new_format = web.db.Data(name=cur_book.data[0].name,
|
|
|
|
if os.path.isfile(file_path + format_new_ext):
|
|
|
|
book_format=self.queue[self.current]['settings']['new_book_format'],
|
|
|
|
new_format = web.db.Data(name=cur_book.data[0].name,
|
|
|
|
book=bookid, uncompressed_size=os.path.getsize(file_path + format_new_ext))
|
|
|
|
book_format=self.queue[self.current]['settings']['new_book_format'],
|
|
|
|
cur_book.data.append(new_format)
|
|
|
|
book=bookid, uncompressed_size=os.path.getsize(file_path + format_new_ext))
|
|
|
|
web.db.session.commit()
|
|
|
|
cur_book.data.append(new_format)
|
|
|
|
self.queue[self.current]['path'] = cur_book.path
|
|
|
|
web.db.session.commit()
|
|
|
|
self.queue[self.current]['title'] = cur_book.title
|
|
|
|
self.queue[self.current]['path'] = cur_book.path
|
|
|
|
if web.ub.config.config_use_google_drive:
|
|
|
|
self.queue[self.current]['title'] = cur_book.title
|
|
|
|
os.remove(file_path + format_old_ext)
|
|
|
|
if web.ub.config.config_use_google_drive:
|
|
|
|
self.queue[self.current]['status'] = STAT_FINISH_SUCCESS
|
|
|
|
os.remove(file_path + format_old_ext)
|
|
|
|
self.UIqueue[self.current]['status'] = _('Finished')
|
|
|
|
self.queue[self.current]['status'] = STAT_FINISH_SUCCESS
|
|
|
|
self.UIqueue[self.current]['progress'] = "100 %"
|
|
|
|
self.UIqueue[self.current]['status'] = _('Finished')
|
|
|
|
self.UIqueue[self.current]['runtime'] = self._formatRuntime(
|
|
|
|
self.UIqueue[self.current]['progress'] = "100 %"
|
|
|
|
datetime.now() - self.queue[self.current]['starttime'])
|
|
|
|
self.UIqueue[self.current]['runtime'] = self._formatRuntime(
|
|
|
|
return file_path + format_new_ext
|
|
|
|
datetime.now() - self.queue[self.current]['starttime'])
|
|
|
|
else:
|
|
|
|
return file_path + format_new_ext
|
|
|
|
web.app.logger.info("ebook converter failed with error while converting book")
|
|
|
|
else:
|
|
|
|
if not error_message:
|
|
|
|
error_message = format_new_ext.upper() + ' format not found on disk'
|
|
|
|
error_message = 'Ebook converter failed with unknown error'
|
|
|
|
web.app.logger.info("ebook converter failed with error while converting book")
|
|
|
|
self._handleError(error_message)
|
|
|
|
if not error_message:
|
|
|
|
return
|
|
|
|
error_message = 'Ebook converter failed with unknown error'
|
|
|
|
|
|
|
|
self._handleError(error_message)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def add_convert(self, file_path, bookid, user_name, typ, settings, kindle_mail=None):
|
|
|
|
def add_convert(self, file_path, bookid, user_name, typ, settings, kindle_mail=None):
|
|
|
|