Prevent converting of kepub on every new user (#2446)

Added error logging message if convert fails
If convert only task, only convert book message is logged
This commit is contained in:
Ozzie Isaacs 2022-06-13 17:04:35 +02:00
parent 89d522e389
commit f85b587d0a
2 changed files with 7 additions and 2 deletions

View File

@ -107,7 +107,7 @@ def generate_auth_token(user_id):
for book in books: for book in books:
formats = [data.format for data in book.data] formats = [data.format for data in book.data]
if not 'KEPUB' in formats and config.config_kepubifypath and 'EPUB' in formats: if 'KEPUB' not in formats and config.config_kepubifypath and 'EPUB' in formats:
helper.convert_book_format(book.id, config.config_calibre_dir, 'EPUB', 'KEPUB', current_user.name) helper.convert_book_format(book.id, config.config_calibre_dir, 'EPUB', 'KEPUB', current_user.name)
return render_title_template( return render_title_template(

View File

@ -188,6 +188,8 @@ class TaskConvert(CalibreTask):
log.info("ebook converter failed with error while converting book") log.info("ebook converter failed with error while converting book")
if not error_message: if not error_message:
error_message = N_('Ebook converter failed with unknown error') error_message = N_('Ebook converter failed with unknown error')
else:
log.error(error_message)
self._handleError(error_message) self._handleError(error_message)
return return
@ -273,7 +275,10 @@ class TaskConvert(CalibreTask):
return N_("Convert") return N_("Convert")
def __str__(self): def __str__(self):
if self.ereader_mail:
return "Convert {} {}".format(self.book_id, self.ereader_mail) return "Convert {} {}".format(self.book_id, self.ereader_mail)
else:
return "Convert {}".format(self.book_id)
@property @property
def is_cancellable(self): def is_cancellable(self):