diff --git a/cps/comic.py b/cps/comic.py index b094c60f..64711460 100644 --- a/cps/comic.py +++ b/cps/comic.py @@ -56,25 +56,25 @@ COVER_EXTENSIONS = ['.png', '.webp', '.bmp', '.jpg', '.jpeg'] def _cover_processing(tmp_file_name, img, extension): tmp_cover_name = os.path.join(os.path.dirname(tmp_file_name), 'cover.jpg') - if use_IM: - # convert to jpg because calibre only supports jpg - if extension in NO_JPEG_EXTENSIONS: - with Image(filename=tmp_file_name) as imgc: + if extension in NO_JPEG_EXTENSIONS: + if use_IM: + with Image(blob=img) as imgc: imgc.format = 'jpeg' imgc.transform_colorspace('rgb') - imgc.save(tmp_cover_name) + imgc.save(filename=tmp_cover_name) return tmp_cover_name - - if not img: + else: + return None + if img: + with open(tmp_cover_name, 'wb') as f: + f.write(img) + return tmp_cover_name + else: return None - with open(tmp_cover_name, 'wb') as f: - f.write(img) - return tmp_cover_name - def _extract_Cover_from_archive(original_file_extension, tmp_file_name, rarExecutable): - cover_data = None + cover_data = extension = None if original_file_extension.upper() == '.CBZ': cf = zipfile.ZipFile(tmp_file_name) for name in cf.namelist(): @@ -106,7 +106,7 @@ def _extract_Cover_from_archive(original_file_extension, tmp_file_name, rarExecu break except Exception as ex: log.debug('Rarfile failed with error: %s', ex) - return cover_data + return cover_data, extension def _extractCover(tmp_file_name, original_file_extension, rarExecutable): @@ -121,7 +121,7 @@ def _extractCover(tmp_file_name, original_file_extension, rarExecutable): cover_data = archive.getPage(index) break else: - cover_data = _extract_Cover_from_archive(original_file_extension, tmp_file_name, rarExecutable) + cover_data, extension = _extract_Cover_from_archive(original_file_extension, tmp_file_name, rarExecutable) return _cover_processing(tmp_file_name, cover_data, extension) diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index 978d371b..84bdae18 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
-

Start Time: 2022-01-17 18:51:33

+

Start Time: 2022-01-18 21:11:17

-

Stop Time: 2022-01-18 07:49:35

+

Stop Time: 2022-01-19 01:03:52

-

Duration: 12h 17 min

+

Duration: 3h 12 min

@@ -1423,11 +1423,11 @@ - + TestLoadMetadata 1 - 1 0 + 1 0 0 @@ -1437,11 +1437,31 @@ - +
TestLoadMetadata - test_load_metadata
- PASS + +
+ FAIL +
+ + + + @@ -1613,19 +1633,9 @@
Traceback (most recent call last):
-  File "/home/ozzie/Development/calibre-web-test/test/test_edit_ebooks_gdrive.py", line 250, in test_edit_title
-    self.fill_basic_config({"config_unicode_filename": 0})
-  File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 358, in fill_basic_config
-    cls._fill_basic_config(elements)
-  File "/home/ozzie/Development/calibre-web-test/test/helper_ui.py", line 268, in _fill_basic_config
-    WebDriverWait(cls.driver, 5).until(EC.presence_of_element_located((By.ID, "config_port")))
-  File "/home/ozzie/Development/calibre-web-test/venv/lib/python3.8/site-packages/selenium/webdriver/support/wait.py", line 89, in until
-    raise TimeoutException(message, screen, stacktrace)
-selenium.common.exceptions.TimeoutException: Message: 
-Stacktrace:
-WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:183:5
-NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.jsm:395:5
-element.find/</<@chrome://remote/content/marionette/element.js:300:16
+ File "/home/ozzie/Development/calibre-web-test/test/test_edit_ebooks_gdrive.py", line 245, in test_edit_title + self.assertEqual(ele.text, u'Very long extra super turbo cool title without any issue of displaying including รถ utf-8 characters') +AttributeError: 'bool' object has no attribute 'text'
@@ -1998,11 +2008,11 @@ element.find/</<@chrome://remote/content/marionette/element.js:300:16 + TestKoboSync 11 - 11 - 0 + 10 + 1 0 0 @@ -2084,11 +2094,31 @@ element.find/</<@chrome://remote/content/marionette/element.js:300:16 +
TestKoboSync - test_sync_shelf
- PASS + +
+ FAIL +
+ + + + @@ -2983,11 +3013,11 @@ element.find/</<@chrome://remote/content/marionette/element.js:300:16 + TestReader 5 - 5 - 0 + 4 + 1 0 0 @@ -3024,11 +3054,37 @@ element.find/</<@chrome://remote/content/marionette/element.js:300:16 +
TestReader - test_sound_listener
- PASS + +
+ FAIL +
+ + + + @@ -3174,13 +3230,13 @@ element.find/</<@chrome://remote/content/marionette/element.js:300:16 TestShelf + 15 14 - 13 0 0 1 - Detail + Detail @@ -3224,7 +3280,7 @@ element.find/</<@chrome://remote/content/marionette/element.js:300:16 -
TestShelf - test_delete_book_of_shelf
+
TestShelf - test_create_public_shelf_no_permission
PASS @@ -3233,7 +3289,7 @@ element.find/</<@chrome://remote/content/marionette/element.js:300:16 -
TestShelf - test_private_shelf
+
TestShelf - test_delete_book_of_shelf
PASS @@ -3242,7 +3298,7 @@ element.find/</<@chrome://remote/content/marionette/element.js:300:16 -
TestShelf - test_public_private_shelf
+
TestShelf - test_private_shelf
PASS @@ -3251,7 +3307,7 @@ element.find/</<@chrome://remote/content/marionette/element.js:300:16 -
TestShelf - test_public_shelf
+
TestShelf - test_public_private_shelf
PASS @@ -3260,7 +3316,7 @@ element.find/</<@chrome://remote/content/marionette/element.js:300:16 -
TestShelf - test_rename_shelf
+
TestShelf - test_public_shelf
PASS @@ -3269,7 +3325,7 @@ element.find/</<@chrome://remote/content/marionette/element.js:300:16 -
TestShelf - test_shelf_action_non_shelf_edit_role
+
TestShelf - test_rename_shelf
PASS @@ -3277,6 +3333,15 @@ element.find/</<@chrome://remote/content/marionette/element.js:300:16 + +
TestShelf - test_shelf_action_non_shelf_edit_role
+ + PASS + + + + +
TestShelf - test_shelf_anonymous
@@ -3285,19 +3350,19 @@ element.find/</<@chrome://remote/content/marionette/element.js:300:16 +
TestShelf - test_shelf_database_change
- SKIP + SKIP
-