From 3814fbf08f541257d1933bc7edde03bcc2a67818 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sun, 14 Jan 2024 14:28:08 +0100 Subject: [PATCH] Bugfixes from testrun --- cps/epub.py | 4 +- cps/helper.py | 1 + cps/tasks/convert.py | 2 +- cps/tasks/metadata_backup.py | 2 +- test/Calibre-Web TestSummary_Linux.html | 2055 +++++++++++++++++------ 5 files changed, 1576 insertions(+), 488 deletions(-) diff --git a/cps/epub.py b/cps/epub.py index e78e5b88..a45fb926 100644 --- a/cps/epub.py +++ b/cps/epub.py @@ -71,8 +71,7 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension): 'dc': 'http://purl.org/dc/elements/1.1/' } - epub_zip = zipfile.ZipFile(tmp_file_path) - tree, cf_name = get_content_opf(epub_zip, ns) + tree, cf_name = get_content_opf(tmp_file_path, ns) cover_path = os.path.dirname(cf_name) @@ -115,6 +114,7 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension): epub_metadata = parse_epub_series(ns, tree, epub_metadata) + epub_zip = zipfile.ZipFile(tmp_file_path) cover_file = parse_epub_cover(ns, tree, epub_zip, cover_path, tmp_file_path) identifiers = [] diff --git a/cps/helper.py b/cps/helper.py index ad89e2bf..975a2523 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -1018,6 +1018,7 @@ def do_calibre_export(book_id, book_format, ): except OSError as ex: # ToDo real error handling log.error_or_exception(ex) + return None, None ################################## diff --git a/cps/tasks/convert.py b/cps/tasks/convert.py index 3b0ee2ea..8cb29197 100644 --- a/cps/tasks/convert.py +++ b/cps/tasks/convert.py @@ -208,7 +208,7 @@ class TaskConvert(CalibreTask): return def _convert_kepubify(self, file_path, format_old_ext, format_new_ext): - if config.config_embed_metadata: + if config.config_embed_metadata and config.config_binariesdir: tmp_dir, temp_file_name = helper.do_calibre_export(self.book_id, format_old_ext[1:]) filename = os.path.join(tmp_dir, temp_file_name + format_old_ext) temp_file_path = tmp_dir diff --git a/cps/tasks/metadata_backup.py b/cps/tasks/metadata_backup.py index 9ca6b830..2f402448 100644 --- a/cps/tasks/metadata_backup.py +++ b/cps/tasks/metadata_backup.py @@ -89,7 +89,7 @@ class TaskBackupMetadata(CalibreTask): def open_metadata(self, book, custom_columns): # package = self.create_new_metadata_backup(book, custom_columns) - package = create_new_metadata_backup(book, custom_columns, self.export_language) + package = create_new_metadata_backup(book, custom_columns, self.export_language, self.translated_title) if config.config_use_google_drive: if not gdriveutils.is_gdrive_ready(): raise Exception('Google Drive is configured but not ready') diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index 879f65f4..cbc8dd34 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
-

Start Time: 2023-12-16 20:44:16

+

Start Time: 2024-01-13 20:33:30

-

Stop Time: 2023-12-17 03:29:30

+

Stop Time: 2024-01-14 03:06:58

-

Duration: 5h 43 min

+

Duration: 5h 26 min

@@ -234,12 +234,12 @@ - + TestBackupMetadata 21 - 21 - 0 - 0 + 1 + 8 + 12 0 Detail @@ -248,29 +248,108 @@ - +
TestBackupMetadata - test_backup_all
- PASS + +
+ FAIL +
+ + + + - +
TestBackupMetadata - test_backup_change_book_author
- PASS + +
+ FAIL +
+ + + + - +
TestBackupMetadata - test_backup_change_book_description
- PASS + +
+ FAIL +
+ + + + @@ -284,165 +363,522 @@ - +
TestBackupMetadata - test_backup_change_book_language
- PASS + +
+ FAIL +
+ + + + - +
TestBackupMetadata - test_backup_change_book_publisher
- PASS + +
+ FAIL +
+ + + + - +
TestBackupMetadata - test_backup_change_book_publishing_date
- PASS + +
+ ERROR +
+ + + + - +
TestBackupMetadata - test_backup_change_book_rating
- PASS + +
+ ERROR +
+ + + + - +
TestBackupMetadata - test_backup_change_book_series_index
- PASS + +
+ ERROR +
+ + + + - +
TestBackupMetadata - test_backup_change_book_tags
- PASS + +
+ FAIL +
+ + + + - +
TestBackupMetadata - test_backup_change_book_title
- PASS + +
+ FAIL +
+ + + + - +
TestBackupMetadata - test_backup_change_custom_Comment
- PASS + +
+ ERROR +
+ + + + - +
TestBackupMetadata - test_backup_change_custom_Enum
- PASS + +
+ ERROR +
+ + + + - +
TestBackupMetadata - test_backup_change_custom_bool
- PASS + +
+ ERROR +
+ + + + - +
TestBackupMetadata - test_backup_change_custom_categories
- PASS + +
+ ERROR +
+ + + + - +
TestBackupMetadata - test_backup_change_custom_date
- PASS + +
+ ERROR +
+ + + + - +
TestBackupMetadata - test_backup_change_custom_float
- PASS + +
+ ERROR +
+ + + + - +
TestBackupMetadata - test_backup_change_custom_int
- PASS + +
+ ERROR +
+ + + + - +
TestBackupMetadata - test_backup_change_custom_rating
- PASS + +
+ ERROR +
+ + + + - +
TestBackupMetadata - test_backup_change_custom_text
- PASS + +
+ ERROR +
+ + + + - +
TestBackupMetadata - test_upload_book
- PASS + +
+ FAIL +
+ + + + - + TestBackupMetadataGdrive 1 - 1 0 + 1 0 0 @@ -452,11 +888,31 @@ - +
TestBackupMetadataGdrive - test_backup_gdrive
- PASS + +
+ FAIL +
+ + + + @@ -645,11 +1101,11 @@ - + TestCoverEditBooks 2 - 2 - 0 + 1 + 1 0 0 @@ -668,11 +1124,31 @@ - +
TestCoverEditBooks - test_upload_jpg
- PASS + +
+ FAIL +
+ + + + @@ -921,11 +1397,11 @@ - + TestEbookConvertKepubify 3 - 3 - 0 + 2 + 1 0 0 @@ -944,11 +1420,33 @@ - +
TestEbookConvertKepubify - test_convert_only
- PASS + +
+ FAIL +
+ + + + @@ -963,11 +1461,11 @@ - + TestEbookConvertGDriveKepubify 3 - 3 - 0 + 2 + 1 0 0 @@ -986,11 +1484,33 @@ - +
TestEbookConvertGDriveKepubify - test_convert_only
- PASS + +
+ FAIL +
+ + + + @@ -1217,11 +1737,11 @@ - + TestEditBooks 38 - 36 - 0 + 35 + 1 0 2 @@ -1544,11 +2064,34 @@ - +
TestEditBooks - test_upload_book_epub
- PASS + +
+ FAIL +
+ + + + @@ -1608,11 +2151,11 @@ - + TestEditAuthors 6 - 6 - 0 + 5 + 1 0 0 @@ -1667,21 +2210,43 @@ - +
TestEditAuthors - test_rename_capital_on_upload
- PASS + +
+ FAIL +
+ + + + - + TestEditAuthorsGdrive 6 - 6 - 0 + 5 + 1 0 0 @@ -1736,11 +2301,33 @@ - +
TestEditAuthorsGdrive - test_rename_capital_on_upload
- PASS + +
+ FAIL +
+ + + + @@ -1923,12 +2510,12 @@ - + TestLoadMetadata 1 - 1 0 0 + 1 0 Detail @@ -1937,11 +2524,31 @@ - +
TestLoadMetadata - test_load_metadata
- PASS + +
+ ERROR +
+ + + + @@ -2270,13 +2877,13 @@ TestEmbedMetadata - 3 - 3 + 5 + 5 0 0 0 - Detail + Detail @@ -2293,7 +2900,7 @@ -
TestEmbedMetadata - test_download_check_metadata
+
TestEmbedMetadata - test_convert_kepub_embed_metadata
PASS @@ -2301,6 +2908,24 @@ + +
TestEmbedMetadata - test_download_check_metadata
+ + PASS + + + + + + +
TestEmbedMetadata - test_download_kepub_embed_metadata
+ + PASS + + + + +
TestEmbedMetadata - test_download_permissions_missing_file
@@ -2310,6 +2935,57 @@ + + TestEmbedMetadataGdrive + 4 + 4 + 0 + 0 + 0 + + Detail + + + + + + + +
TestEmbedMetadataGdrive - test_convert_file_embed_metadata
+ + PASS + + + + + + +
TestEmbedMetadataGdrive - test_convert_kepub_embed_metadata
+ + PASS + + + + + + +
TestEmbedMetadataGdrive - test_download_check_metadata
+ + PASS + + + + + + +
TestEmbedMetadataGdrive - test_download_kepub_embed_metadata
+ + PASS + + + + + TestBookDatabase 1 @@ -2318,13 +2994,13 @@ 0 0 - Detail + Detail - +
TestBookDatabase - test_invalid_book_path
@@ -2342,13 +3018,13 @@ 0 0 - Detail + Detail - +
TestErrorReadColumn - test_invalid_custom_column
@@ -2357,7 +3033,7 @@ - +
TestErrorReadColumn - test_invalid_custom_read_column
@@ -2375,13 +3051,13 @@ 0 1 - Detail + Detail - +
TestFilePicker - test_filepicker_limited_file
@@ -2390,19 +3066,19 @@ - +
TestFilePicker - test_filepicker_new_file
- SKIP + SKIP
-