From f85b587d0a6d2e35a648337d7952b980d28caf39 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Mon, 13 Jun 2022 17:04:35 +0200 Subject: [PATCH] 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 --- cps/kobo_auth.py | 2 +- cps/tasks/convert.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cps/kobo_auth.py b/cps/kobo_auth.py index 9865b993..ea9b71b1 100644 --- a/cps/kobo_auth.py +++ b/cps/kobo_auth.py @@ -107,7 +107,7 @@ def generate_auth_token(user_id): for book in books: 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) return render_title_template( diff --git a/cps/tasks/convert.py b/cps/tasks/convert.py index a9f0f055..48fd528e 100755 --- a/cps/tasks/convert.py +++ b/cps/tasks/convert.py @@ -188,6 +188,8 @@ class TaskConvert(CalibreTask): log.info("ebook converter failed with error while converting book") if not error_message: error_message = N_('Ebook converter failed with unknown error') + else: + log.error(error_message) self._handleError(error_message) return @@ -273,7 +275,10 @@ class TaskConvert(CalibreTask): return N_("Convert") def __str__(self): - return "Convert {} {}".format(self.book_id, self.ereader_mail) + if self.ereader_mail: + return "Convert {} {}".format(self.book_id, self.ereader_mail) + else: + return "Convert {}".format(self.book_id) @property def is_cancellable(self):