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,12 +1965,12 @@ - + TestLoadMetadata 1 + 1 0 0 - 1 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,39 +3716,104 @@ KeyError: 'title' - + TestReader - 6 + 8 5 1 - 0 - 0 + 1 + 1 - Detail + Detail - + + +
TestReader - test_cb7_reader
+ + SKIP + + + + +
TestReader - test_comic_MACOS_files
- PASS + +
+ ERROR +
+ + + + - +
TestReader - test_comic_reader
- PASS + +
+ FAIL +
+ + + + - +
TestReader - test_epub_reader
@@ -3664,7 +3822,7 @@ KeyError: 'title' - +
TestReader - test_pdf_reader
@@ -3673,42 +3831,25 @@ KeyError: 'title' - + -
TestReader - test_sound_listener
+
TestReader - test_single_file_comic
- -
- FAIL -
- - - + PASS + + + + + + +
TestReader - test_sound_listener
+ PASS - +
TestReader - test_txt_reader
@@ -4047,11 +4188,11 @@ AssertionError: '0:02' != '0:01' - - TestThumbnailsEnv - 1 + + TestSocket 1 0 + 1 0 0 @@ -4061,113 +4202,684 @@ AssertionError: '0:02' != '0:01' - + -
TestThumbnailsEnv - test_cover_cache_env_on_database_change
+
TestSocket - test_socket_communication
+ + +
+ FAIL +
+ + + - PASS - - TestThumbnails - 8 - 6 + + TestSystemdActivation 1 0 + 0 1 + 0 - Detail + Detail - + -
TestThumbnails - test_cache_non_writable
+
TestSystemdActivation - test_systemd_activation
+ + +
+ ERROR +
+ + + - PASS + + + + TestThumbnailsEnv + 1 + 0 + 0 + 1 + 0 + + Detail + + + + - + -
TestThumbnails - test_cache_of_deleted_book
+
TestThumbnailsEnv - test_cover_cache_env_on_database_change
+ + +
+ ERROR +
+ + + - PASS + + + + _ErrorHolder + 6 + 0 + 0 + 6 + 0 + + Detail + + + + - + -
TestThumbnails - test_cover_cache_on_database_change
+
tearDownClass (test_thumbnail_env)
+ + +
+ ERROR +
+ + + - PASS - + -
TestThumbnails - test_cover_change_on_upload_new_cover
+
tearDownClass (test_thumbnails)
+ + +
+ ERROR +
+ + + - PASS - + -
TestThumbnails - test_cover_for_series
+
tearDownClass (test_upload_epubs)
+ + +
+ ERROR +
+ + + - SKIP - + -
TestThumbnails - test_cover_on_upload_book
+
tearDownClass (test_user_list)
+ + +
+ ERROR +
+ + + - PASS - + -
TestThumbnails - test_remove_cover_from_cache
+
tearDownClass (test_user_load)
+ + +
+ ERROR +
+ + + - PASS - + -
TestThumbnails - test_sideloaded_book
+
tearDownClass (test_visiblilitys)
- FAIL + ERROR
-