From 9ef89dbcc383099bbcc5573e97eef73efb181b37 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sun, 10 Dec 2023 07:26:26 +0100 Subject: [PATCH] Bugfix convert file from gdrive without cover Update Teststatus --- cps/tasks/convert.py | 19 +- test/Calibre-Web TestSummary_Linux.html | 6263 +++++++++++++++++++++-- 2 files changed, 5783 insertions(+), 499 deletions(-) diff --git a/cps/tasks/convert.py b/cps/tasks/convert.py index a39b3f61..913b92dd 100755 --- a/cps/tasks/convert.py +++ b/cps/tasks/convert.py @@ -66,29 +66,32 @@ class TaskConvert(CalibreTask): df = gdriveutils.getFileFromEbooksFolder(cur_book.path, data.name + "." + self.settings['old_book_format'].lower()) df_cover = gdriveutils.getFileFromEbooksFolder(cur_book.path, "cover.jpg") - if df and df_cover: + if df: datafile = os.path.join(config.config_calibre_dir, cur_book.path, data.name + "." + self.settings['old_book_format'].lower()) - datafile_cover = os.path.join(config.config_calibre_dir, - cur_book.path, "cover.jpg") + if df_cover: + datafile_cover = os.path.join(config.config_calibre_dir, + cur_book.path, "cover.jpg") if not os.path.exists(os.path.join(config.config_calibre_dir, cur_book.path)): os.makedirs(os.path.join(config.config_calibre_dir, cur_book.path)) df.GetContentFile(datafile) - df_cover.GetContentFile(datafile_cover) + if df_cover: + df_cover.GetContentFile(datafile_cover) worker_db.session.close() else: - # ToDo Include cover in error handling + # ToDo Include cover in error handling error_message = _("%(format)s not found on Google Drive: %(fn)s", format=self.settings['old_book_format'], fn=data.name + "." + self.settings['old_book_format'].lower()) worker_db.session.close() - return error_message + return self._handleError(self, error_message) filename = self._convert_ebook_format() if config.config_use_google_drive: os.remove(self.file_path + '.' + self.settings['old_book_format'].lower()) - os.remove(os.path.join(config.config_calibre_dir, cur_book.path, "cover.jpg")) + if df_cover: + os.remove(os.path.join(config.config_calibre_dir, cur_book.path, "cover.jpg")) if filename: if config.config_use_google_drive: @@ -254,7 +257,7 @@ class TaskConvert(CalibreTask): command = [config.config_converterpath, (file_path + format_old_ext), (file_path + format_new_ext)] if config.config_embed_metadata: - command.extend('--from-opf', path_tmp_opf) + command.extend(['--from-opf', path_tmp_opf]) if has_cover: command.extend(['--cover', os.path.join(os.path.dirname(file_path), 'cover.jpg')]) quotes_index = 3 diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index 7ca3dad5..03883e3b 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
-

Start Time: 2023-10-16 19:38:22

+

Start Time: 2023-12-10 09:21:07

-

Stop Time: 2023-10-17 02:18:49

+

Stop Time: 2023-12-10 14:53:07

-

Duration: 5h 37 min

+

Duration: 4h 31 min

@@ -236,13 +236,13 @@ TestBackupMetadata - 22 - 22 + 21 + 21 0 0 0 - Detail + Detail @@ -429,15 +429,6 @@ - -
TestBackupMetadata - test_gdrive
- - PASS - - - - -
TestBackupMetadata - test_upload_book
@@ -861,12 +852,12 @@ - + TestEbookConvertCalibreGDrive 6 - 6 - 0 - 0 + 4 + 1 + 1 0 Detail @@ -875,20 +866,62 @@ - +
TestEbookConvertCalibreGDrive - test_convert_email
- PASS + +
+ ERROR +
+ + + + - +
TestEbookConvertCalibreGDrive - test_convert_failed_and_email
- PASS + +
+ FAIL +
+ + + + @@ -1932,13 +1965,13 @@ - + TestLoadMetadata 1 - 0 - 0 1 0 + 0 + 0 Detail @@ -1946,42 +1979,22 @@ - +
TestLoadMetadata - test_load_metadata
- -
- ERROR -
- - - - + PASS - + TestEditBooksOnGdrive 18 - 17 + 18 + 0 0 - 1 0 Detail @@ -2125,31 +2138,11 @@ IndexError: list index out of range - +
TestEditBooksOnGdrive - test_edit_title
- -
- ERROR -
- - - - + PASS @@ -2691,12 +2684,12 @@ KeyError: 'title' - + TestLdapLogin 13 - 13 - 0 + 11 0 + 2 0 Detail @@ -2804,20 +2797,91 @@ KeyError: 'title' - +
TestLdapLogin - test_ldap_opds_anonymous
- PASS + +
+ ERROR +
+ + + + - +
TestLdapLogin - test_ldap_opds_download_book
- PASS + +
+ ERROR +
+ + + + @@ -3092,15 +3156,15 @@ KeyError: 'title' - + TestLogin + 18 17 - 17 - 0 + 1 0 0 - Detail + Detail @@ -3241,7 +3305,36 @@ KeyError: 'title' - + + +
TestLogin - test_proxy_login_multi_user
+ + +
+ FAIL +
+ + + + + + + + +
TestLogin - test_proxy_login_opds
@@ -3250,7 +3343,7 @@ KeyError: 'title' - +
TestLogin - test_robots
@@ -3623,82 +3716,65 @@ KeyError: 'title' - + TestReader - 6 + 8 5 1 - 0 - 0 + 1 + 1 - Detail + Detail - + + +
TestReader - test_cb7_reader
+ + SKIP + + + + +
TestReader - test_comic_MACOS_files
- PASS - - - - - - -
TestReader - test_comic_reader
- - PASS - - - - - - -
TestReader - test_epub_reader
- - PASS - - - - - - -
TestReader - test_pdf_reader
- - PASS - - - - - - -
TestReader - test_sound_listener
-
- FAIL + ERROR
-