From 095074f977d1cb146de66be2199e43efa0cf0519 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Mon, 12 Aug 2024 18:29:31 +0200 Subject: [PATCH 1/8] Fix metadata search results --- cps/metadata_provider/amazon.py | 11 +++++------ cps/metadata_provider/google.py | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cps/metadata_provider/amazon.py b/cps/metadata_provider/amazon.py index 843a9d764..ee3de1ceb 100644 --- a/cps/metadata_provider/amazon.py +++ b/cps/metadata_provider/amazon.py @@ -53,7 +53,6 @@ class Amazon(Metadata): def search( self, query: str, generic_cover: str = "", locale: str = "en" ) -> Optional[List[MetaRecord]]: - #timer=time() def inner(link, index) -> [dict, int]: with self.session as session: try: @@ -61,11 +60,11 @@ class Amazon(Metadata): r.raise_for_status() except Exception as ex: log.warning(ex) - return None + return [] long_soup = BS(r.text, "lxml") #~4sec :/ soup2 = long_soup.find("div", attrs={"cel_widget_id": "dpx-books-ppd_csm_instrumentation_wrapper"}) if soup2 is None: - return None + return [] try: match = MetaRecord( title = "", @@ -88,7 +87,7 @@ class Amazon(Metadata): soup2.find("div", attrs={"data-feature-name": "bookDescription"}).stripped_strings)\ .replace("\xa0"," ")[:-9].strip().strip("\n") except (AttributeError, TypeError): - return None # if there is no description it is not a book and therefore should be ignored + return [] # if there is no description it is not a book and therefore should be ignored try: match.title = soup2.find("span", attrs={"id": "productTitle"}).text except (AttributeError, TypeError): @@ -113,7 +112,7 @@ class Amazon(Metadata): return match, index except Exception as e: log.error_or_exception(e) - return None + return [] val = list() if self.active: @@ -134,6 +133,6 @@ class Amazon(Metadata): soup.findAll("div", attrs={"data-component-type": "s-search-result"})] with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor: fut = {executor.submit(inner, link, index) for index, link in enumerate(links_list[:5])} - val = list(map(lambda x : x.result() ,concurrent.futures.as_completed(fut))) + val = list(map(lambda x : x.result(), concurrent.futures.as_completed(fut))) result = list(filter(lambda x: x, val)) return [x[0] for x in sorted(result, key=itemgetter(1))] #sort by amazons listing order for best relevance diff --git a/cps/metadata_provider/google.py b/cps/metadata_provider/google.py index ba7e10af1..df9c0dc24 100644 --- a/cps/metadata_provider/google.py +++ b/cps/metadata_provider/google.py @@ -54,7 +54,7 @@ class Google(Metadata): results.raise_for_status() except Exception as e: log.warning(e) - return None + return [] for result in results.json().get("items", []): val.append( self._parse_search_result( From 5f81084e66288d8fdac0070645412bcb147a0683 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Mon, 12 Aug 2024 18:30:49 +0200 Subject: [PATCH 2/8] Updated testresults --- test/Calibre-Web TestSummary_Linux.html | 596 +++++++++++++++--------- 1 file changed, 364 insertions(+), 232 deletions(-) diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index fc1ed2e37..8b5335b9c 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
-

Start Time: 2024-08-04 21:24:21

+

Start Time: 2024-08-11 19:57:31

-

Stop Time: 2024-08-05 04:56:20

+

Stop Time: 2024-08-12 03:10:54

-

Duration: 6h 17 min

+

Duration: 5h 59 min

@@ -1228,13 +1228,13 @@ TestEditBooks - 38 + 37 36 0 0 - 2 + 1 - Detail + Detail @@ -1437,33 +1437,7 @@ - - -
TestEditBooks - test_rename_uppercase_lowercase
- - -
- SKIP -
- - - - - - - - - +
TestEditBooks - test_typeahead_author
@@ -1472,7 +1446,7 @@ - +
TestEditBooks - test_typeahead_functions
@@ -1481,7 +1455,7 @@ - +
TestEditBooks - test_typeahead_language
@@ -1490,7 +1464,7 @@ - +
TestEditBooks - test_typeahead_publisher
@@ -1499,7 +1473,7 @@ - +
TestEditBooks - test_typeahead_series
@@ -1508,7 +1482,7 @@ - +
TestEditBooks - test_typeahead_tag
@@ -1517,7 +1491,7 @@ - +
TestEditBooks - test_upload_book_cb7
@@ -1526,7 +1500,7 @@ - +
TestEditBooks - test_upload_book_cbr
@@ -1535,7 +1509,7 @@ - +
TestEditBooks - test_upload_book_cbt
@@ -1544,7 +1518,7 @@ - +
TestEditBooks - test_upload_book_cbz
@@ -1553,7 +1527,7 @@ - +
TestEditBooks - test_upload_book_epub
@@ -1562,7 +1536,7 @@ - +
TestEditBooks - test_upload_book_fb2
@@ -1571,7 +1545,7 @@ - +
TestEditBooks - test_upload_book_lit
@@ -1580,7 +1554,7 @@ - +
TestEditBooks - test_upload_book_mobi
@@ -1589,7 +1563,7 @@ - +
TestEditBooks - test_upload_book_pdf
@@ -1598,7 +1572,7 @@ - +
TestEditBooks - test_upload_cbz_coverformats
@@ -1607,7 +1581,7 @@ - +
TestEditBooks - test_upload_cover_hdd
@@ -3921,43 +3895,50 @@ IndexError: list index out of range - - TestPipInstall - 3 - 3 + + _FailedTest + 1 0 0 + 1 0 - Detail + Detail - + -
TestPipInstall - test_command_start
+
_FailedTest - test_pip_install
- PASS - - - - - - -
TestPipInstall - test_foldername_database_location
+ +
+ ERROR +
+ + + - PASS - - - - - - -
TestPipInstall - test_module_start
- - PASS @@ -4579,11 +4560,31 @@ IndexError: list index out of range - +
TestThumbnails - test_cover_change_on_upload_new_cover
- PASS + +
+ FAIL +
+ + + + @@ -4615,31 +4616,11 @@ IndexError: list index out of range - +
TestThumbnails - test_sideloaded_book
- -
- FAIL -
- - - - + PASS @@ -4758,15 +4739,15 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - - TestUploadEPubs - 6 - 6 - 0 + + TestUploadAudio + 12 + 11 + 1 0 0 - Detail + Detail @@ -4774,7 +4755,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 -
TestUploadEPubs - test_upload_epub_comments
+
TestUploadAudio - test_upload_aac
PASS @@ -4783,7 +4764,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 -
TestUploadEPubs - test_upload_epub_cover
+
TestUploadAudio - test_upload_aiff
PASS @@ -4791,6 +4772,151 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 + +
TestUploadAudio - test_upload_asf
+ + PASS + + + + + + +
TestUploadAudio - test_upload_flac
+ + +
+ FAIL +
+ + + + + + + + + + +
TestUploadAudio - test_upload_m4a
+ + PASS + + + + + + +
TestUploadAudio - test_upload_m4b
+ + PASS + + + + + + +
TestUploadAudio - test_upload_mp3
+ + PASS + + + + + + +
TestUploadAudio - test_upload_mp4
+ + PASS + + + + + + +
TestUploadAudio - test_upload_oggvorbis
+ + PASS + + + + + + +
TestUploadAudio - test_upload_ogv
+ + PASS + + + + + + +
TestUploadAudio - test_upload_opus
+ + PASS + + + + + + +
TestUploadAudio - test_upload_wav
+ + PASS + + + + + + + TestUploadEPubs + 6 + 6 + 0 + 0 + 0 + + Detail + + + + + + + +
TestUploadEPubs - test_upload_epub_comments
+ + PASS + + + + + + +
TestUploadEPubs - test_upload_epub_cover
+ + PASS + + + + +
TestUploadEPubs - test_upload_epub_cover_formats
@@ -4799,7 +4925,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUploadEPubs - test_upload_epub_duplicate
@@ -4808,7 +4934,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUploadEPubs - test_upload_epub_identifier
@@ -4817,7 +4943,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUploadEPubs - test_upload_epub_lang
@@ -4835,13 +4961,13 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 0 0 - Detail + Detail - +
TestUserList - test_edit_user_email
@@ -4850,7 +4976,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_list_visibility
@@ -4859,7 +4985,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_admin_role
@@ -4868,7 +4994,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_check_sort
@@ -4877,7 +5003,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_denied_tags
@@ -4886,7 +5012,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_download_role
@@ -4895,7 +5021,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_edit_button
@@ -4904,7 +5030,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_edit_email
@@ -4913,7 +5039,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_edit_kindle
@@ -4922,7 +5048,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_edit_language
@@ -4931,7 +5057,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_edit_locale
@@ -4940,7 +5066,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_edit_name
@@ -4949,7 +5075,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_edit_visiblility
@@ -4958,7 +5084,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_guest_edit
@@ -4967,7 +5093,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_remove_admin
@@ -4976,7 +5102,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_requests
@@ -4985,7 +5111,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_search
@@ -4994,7 +5120,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserList - test_user_list_sort
@@ -5012,13 +5138,13 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 0 0 - Detail + Detail - +
TestUserLoad - test_user_change_vis
@@ -5036,13 +5162,13 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 0 0 - Detail + Detail - +
TestUserTemplate - test_allow_column_restriction
@@ -5051,7 +5177,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_allow_tag_restriction
@@ -5060,7 +5186,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_archived_format_template
@@ -5069,7 +5195,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_author_user_template
@@ -5078,7 +5204,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_best_user_template
@@ -5087,7 +5213,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_category_user_template
@@ -5096,7 +5222,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_deny_column_restriction
@@ -5105,7 +5231,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_deny_tag_restriction
@@ -5114,7 +5240,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_detail_random_user_template
@@ -5123,7 +5249,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_download_user_template
@@ -5132,7 +5258,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_format_user_template
@@ -5141,7 +5267,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_hot_user_template
@@ -5150,7 +5276,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_language_user_template
@@ -5159,7 +5285,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_limit_book_languages
@@ -5168,7 +5294,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_list_user_template
@@ -5177,7 +5303,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_publisher_user_template
@@ -5186,7 +5312,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_random_user_template
@@ -5195,7 +5321,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_read_user_template
@@ -5204,7 +5330,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_recent_user_template
@@ -5213,7 +5339,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_series_user_template
@@ -5222,7 +5348,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestUserTemplate - test_ui_language_settings
@@ -5240,13 +5366,13 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 0 0 - Detail + Detail - +
TestCalibreWebVisibilitys - test_about
@@ -5255,7 +5381,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_admin_SMTP_Settings
@@ -5264,7 +5390,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_admin_add_user
@@ -5273,7 +5399,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_admin_change_password
@@ -5282,7 +5408,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_admin_change_visibility_archived
@@ -5291,7 +5417,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_admin_change_visibility_authors
@@ -5300,7 +5426,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_admin_change_visibility_category
@@ -5309,7 +5435,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_admin_change_visibility_file_formats
@@ -5318,7 +5444,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_admin_change_visibility_hot
@@ -5327,7 +5453,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_admin_change_visibility_language
@@ -5336,7 +5462,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_admin_change_visibility_publisher
@@ -5345,7 +5471,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_admin_change_visibility_random
@@ -5354,7 +5480,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_admin_change_visibility_rated
@@ -5363,7 +5489,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_admin_change_visibility_rating
@@ -5372,7 +5498,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_admin_change_visibility_read
@@ -5381,7 +5507,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_admin_change_visibility_series
@@ -5390,7 +5516,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_allow_columns
@@ -5399,7 +5525,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_allow_tags
@@ -5408,7 +5534,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_archive_books
@@ -5417,7 +5543,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_authors_max_settings
@@ -5426,7 +5552,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_change_title
@@ -5435,7 +5561,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_checked_logged_in
@@ -5444,7 +5570,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_hide_custom_column
@@ -5453,7 +5579,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_link_column_to_read_status
@@ -5462,7 +5588,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_random_books_available
@@ -5471,7 +5597,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_read_status_visible
@@ -5480,7 +5606,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_request_link_column_to_read_status
@@ -5489,7 +5615,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_restrict_columns
@@ -5498,7 +5624,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_restrict_tags
@@ -5507,7 +5633,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_save_views_recent
@@ -5516,7 +5642,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_search_functions
@@ -5525,7 +5651,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_search_order
@@ -5534,7 +5660,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_search_string
@@ -5543,7 +5669,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_user_email_available
@@ -5552,7 +5678,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreWebVisibilitys - test_user_visibility_sidebar
@@ -5570,13 +5696,13 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 0 0 - Detail + Detail - +
TestCalibreHelper - test_author_sort
@@ -5585,7 +5711,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreHelper - test_author_sort_comma
@@ -5594,7 +5720,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreHelper - test_author_sort_junior
@@ -5603,7 +5729,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreHelper - test_author_sort_oneword
@@ -5612,7 +5738,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreHelper - test_author_sort_roman
@@ -5621,7 +5747,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreHelper - test_check_Limit_Length
@@ -5630,7 +5756,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreHelper - test_check_char_replacement
@@ -5639,7 +5765,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreHelper - test_check_chinese_Characters
@@ -5648,7 +5774,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreHelper - test_check_deg_eur_replacement
@@ -5657,7 +5783,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreHelper - test_check_doubleS
@@ -5666,7 +5792,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreHelper - test_check_finish_Dot
@@ -5675,7 +5801,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreHelper - test_check_high23
@@ -5684,7 +5810,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreHelper - test_check_umlauts
@@ -5693,7 +5819,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreHelper - test_random_password
@@ -5702,7 +5828,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreHelper - test_split_authors
@@ -5711,7 +5837,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - +
TestCalibreHelper - test_whitespaces
@@ -5722,11 +5848,11 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 Total - 510 - 498 - 1 - 1 - 10 + 519 + 506 + 2 + 2 + 9   @@ -5777,8 +5903,8 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 - Babel - 2.15.0 + babel + 2.16.0 Basic @@ -5790,7 +5916,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 chardet - 4.0.0 + 5.2.0 Basic @@ -5892,7 +6018,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 SQLAlchemy - 2.0.31 + 2.0.32 Basic @@ -5922,7 +6048,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 google-api-python-client - 2.139.0 + 2.140.0 TestBackupMetadataGdrive @@ -5946,13 +6072,13 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 PyYAML - 6.0.1 + 6.0.2 TestBackupMetadataGdrive google-api-python-client - 2.139.0 + 2.140.0 TestCliGdrivedb @@ -5976,13 +6102,13 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 PyYAML - 6.0.1 + 6.0.2 TestCliGdrivedb google-api-python-client - 2.139.0 + 2.140.0 TestEbookConvertCalibreGDrive @@ -6006,13 +6132,13 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 PyYAML - 6.0.1 + 6.0.2 TestEbookConvertCalibreGDrive google-api-python-client - 2.139.0 + 2.140.0 TestEbookConvertGDriveKepubify @@ -6036,7 +6162,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 PyYAML - 6.0.1 + 6.0.2 TestEbookConvertGDriveKepubify @@ -6054,13 +6180,13 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 py7zr - 0.21.1 + 0.22.0 TestEditBooks google-api-python-client - 2.139.0 + 2.140.0 TestEditAuthorsGdrive @@ -6084,7 +6210,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 PyYAML - 6.0.1 + 6.0.2 TestEditAuthorsGdrive @@ -6096,7 +6222,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 google-api-python-client - 2.139.0 + 2.140.0 TestEditBooksOnGdrive @@ -6120,7 +6246,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 PyYAML - 6.0.1 + 6.0.2 TestEditBooksOnGdrive @@ -6138,7 +6264,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 google-api-python-client - 2.139.0 + 2.140.0 TestEmbedMetadataGdrive @@ -6162,13 +6288,13 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 PyYAML - 6.0.1 + 6.0.2 TestEmbedMetadataGdrive google-api-python-client - 2.139.0 + 2.140.0 TestSetupGdrive @@ -6192,7 +6318,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 PyYAML - 6.0.1 + 6.0.2 TestSetupGdrive @@ -6250,6 +6376,12 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 TestOAuthLogin + + mutagen + 1.47.0 + TestUploadAudio + + @@ -6258,7 +6390,7 @@ AssertionError: 0.005925365701836291 != 0.0 within 0.0001 delta (0.0059253657018 From 87b82424d54c8d08e125b42d541db1dcdfcefe7b Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Mon, 12 Aug 2024 18:41:20 +0200 Subject: [PATCH 3/8] Improved whitespace removal Testresults --- cps/admin.py | 22 ++++---- cps/config_sql.py | 12 ++-- cps/db.py | 11 ++-- cps/editbooks.py | 24 ++++---- cps/epub.py | 3 +- cps/helper.py | 31 ++++++----- cps/search.py | 8 +-- cps/string_helper.py | 23 ++++++++ cps/tasks/convert.py | 3 +- cps/tasks/mail.py | 5 +- cps/ub.py | 10 ++-- cps/uploader.py | 5 +- cps/web.py | 11 ++-- test/Calibre-Web TestSummary_Linux.html | 74 ++++++------------------- 14 files changed, 115 insertions(+), 127 deletions(-) create mode 100644 cps/string_helper.py diff --git a/cps/admin.py b/cps/admin.py index 5f481fa18..5daad9588 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -54,6 +54,7 @@ from .services.worker import WorkerThread from .usermanagement import user_login_required from .babel import get_available_translations, get_available_locale, get_user_locale_language from . import debug_info +from .string_helper import strip_whitespaces log = logger.create() @@ -463,9 +464,9 @@ def edit_list_user(param): if 'value[]' in vals: setattr(user, param, prepare_tags(user, vals['action'][0], param, vals['value[]'])) else: - setattr(user, param, vals['value'].strip()) + setattr(user, param, strip_whitespaces(vals['value'])) else: - vals['value'] = vals['value'].strip() + vals['value'] = strip_whitespaces(vals['value']) if param == 'name': if user.name == "Guest": raise Exception(_("Guest Name can't be changed")) @@ -690,7 +691,7 @@ def delete_domain(): def list_domain(allow): answer = ub.session.query(ub.Registration).filter(ub.Registration.allow == allow).all() json_dumps = json.dumps([{"domain": r.domain.replace('%', '*').replace('_', '?'), "id": r.id} for r in answer]) - js = json.dumps(json_dumps.replace('"', "'")).lstrip('"').strip('"') + js = json.dumps(json_dumps.replace('"', "'")).strip('"') response = make_response(js.replace("'", '"')) response.headers["Content-Type"] = "application/json; charset=utf-8" return response @@ -1100,7 +1101,7 @@ def _config_checkbox_int(to_save, x): def _config_string(to_save, x): - return config.set_from_dictionary(to_save, x, lambda y: y.strip().strip(u'\u200B\u200C\u200D\ufeff') if y else y) + return config.set_from_dictionary(to_save, x, lambda y: strip_whitespaces(y) if y else y) def _configuration_gdrive_helper(to_save): @@ -1311,9 +1312,9 @@ def update_mailsettings(): if to_save.get("mail_password_e", ""): _config_string(to_save, "mail_password_e") _config_int(to_save, "mail_size", lambda y: int(y) * 1024 * 1024) - config.mail_server = to_save.get('mail_server', "").strip() - config.mail_from = to_save.get('mail_from', "").strip() - config.mail_login = to_save.get('mail_login', "").strip() + config.mail_server = strip_whitespaces(to_save.get('mail_server', "")) + config.mail_from = strip_whitespaces(to_save.get('mail_from', "")) + config.mail_login = strip_whitespaces(to_save.get('mail_login', "")) try: config.save() except (OperationalError, InvalidRequestError) as e: @@ -1678,10 +1679,10 @@ def cancel_task(): def _db_simulate_change(): param = request.form.to_dict() to_save = dict() - to_save['config_calibre_dir'] = re.sub(r'[\\/]metadata\.db$', + to_save['config_calibre_dir'] = strip_whitespaces(re.sub(r'[\\/]metadata\.db$', '', param['config_calibre_dir'], - flags=re.IGNORECASE).strip() + flags=re.IGNORECASE)) db_valid, db_change = calibre_db.check_valid_db(to_save["config_calibre_dir"], ub.app_DB_path, config.config_calibre_uuid) @@ -1775,9 +1776,8 @@ def _configuration_update_helper(): if "config_upload_formats" in to_save: to_save["config_upload_formats"] = ','.join( - helper.uniq([x.lstrip().rstrip().lower() for x in to_save["config_upload_formats"].split(',')])) + helper.uniq([x.strip().lower() for x in to_save["config_upload_formats"].split(',')])) _config_string(to_save, "config_upload_formats") - # constants.EXTENSIONS_UPLOAD = config.config_upload_formats.split(',') _config_string(to_save, "config_calibre") _config_string(to_save, "config_binariesdir") diff --git a/cps/config_sql.py b/cps/config_sql.py index 044c12b51..6a840af58 100644 --- a/cps/config_sql.py +++ b/cps/config_sql.py @@ -35,7 +35,7 @@ except ImportError: from . import constants, logger from .subproc_wrapper import process_wait - +from .string_helper import strip_whitespaces log = logger.create() _Base = declarative_base() @@ -288,19 +288,19 @@ class ConfigSQL(object): def list_denied_tags(self): mct = self.config_denied_tags or "" - return [t.strip() for t in mct.split(",")] + return [strip_whitespaces(t) for t in mct.split(",")] def list_allowed_tags(self): mct = self.config_allowed_tags or "" - return [t.strip() for t in mct.split(",")] + return [strip_whitespaces(t) for t in mct.split(",")] def list_denied_column_values(self): mct = self.config_denied_column_value or "" - return [t.strip() for t in mct.split(",")] + return [strip_whitespaces(t) for t in mct.split(",")] def list_allowed_column_values(self): mct = self.config_allowed_column_value or "" - return [t.strip() for t in mct.split(",")] + return [strip_whitespaces(t) for t in mct.split(",")] def get_log_level(self): return logger.get_level_name(self.config_log_level) @@ -372,7 +372,7 @@ class ConfigSQL(object): db_file = os.path.join(self.config_calibre_dir, 'metadata.db') have_metadata_db = os.path.isfile(db_file) self.db_configured = have_metadata_db - # constants.EXTENSIONS_UPLOAD = [x.lstrip().rstrip().lower() for x in self.config_upload_formats.split(',')] + from . import cli_param if os.environ.get('FLASK_DEBUG'): logfile = logger.setup(logger.LOG_TO_STDOUT, logger.logging.DEBUG) diff --git a/cps/db.py b/cps/db.py index d0edb871f..dc08a7de9 100644 --- a/cps/db.py +++ b/cps/db.py @@ -48,7 +48,7 @@ from flask import flash from . import logger, ub, isoLanguages from .pagination import Pagination - +from .string_helper import strip_whitespaces log = logger.create() @@ -875,10 +875,11 @@ class CalibreDB: authors_ordered = list() # error = False for auth in sort_authors: - results = self.session.query(Authors).filter(Authors.sort == auth.lstrip().strip()).all() + auth = strip_whitespaces(auth) + results = self.session.query(Authors).filter(Authors.sort == auth).all() # ToDo: How to handle not found author name if not len(results): - log.error("Author {} not found to display name in right order".format(auth.strip())) + log.error("Author {} not found to display name in right order".format(auth)) # error = True break for r in results: @@ -918,7 +919,7 @@ class CalibreDB: .filter(and_(Books.authors.any(and_(*q)), func.lower(Books.title).ilike("%" + title + "%"))).first() def search_query(self, term, config, *join): - term.strip().lower() + strip_whitespaces(term).lower() self.session.connection().connection.connection.create_function("lower", 1, lcase) q = list() author_terms = re.split("[, ]+", term) @@ -1026,7 +1027,7 @@ class CalibreDB: if match: prep = match.group(1) title = title[len(prep):] + ', ' + prep - return title.strip() + return strip_whitespaces(title) try: # sqlalchemy <1.4.24 and sqlalchemy 2.0 diff --git a/cps/editbooks.py b/cps/editbooks.py index f1943a79a..122b1c2cc 100644 --- a/cps/editbooks.py +++ b/cps/editbooks.py @@ -47,7 +47,7 @@ from .kobo_sync_status import change_archived_books from .redirect import get_redirect_location from .file_helper import validate_mime_type from .usermanagement import user_login_required, login_required_if_no_ano - +from .string_helper import strip_whitespaces editbook = Blueprint('edit-book', __name__) log = logger.create() @@ -979,7 +979,7 @@ def render_edit_book(book_id): def edit_book_ratings(to_save, book): changed = False - if to_save.get("rating", "").strip(): + if strip_whitespaces(to_save.get("rating", "")): old_rating = False if len(book.ratings) > 0: old_rating = book.ratings[0].rating @@ -1003,14 +1003,14 @@ def edit_book_ratings(to_save, book): def edit_book_tags(tags, book): input_tags = tags.split(',') - input_tags = list(map(lambda it: it.strip(), input_tags)) + input_tags = list(map(lambda it: strip_whitespaces(it), input_tags)) # Remove duplicates input_tags = helper.uniq(input_tags) return modify_database_object(input_tags, book.tags, db.Tags, calibre_db.session, 'tags') def edit_book_series(series, book): - input_series = [series.strip()] + input_series = [strip_whitespaces(series)] input_series = [x for x in input_series if x != ''] return modify_database_object(input_series, book.series, db.Series, calibre_db.session, 'series') @@ -1072,7 +1072,7 @@ def edit_book_languages(languages, book, upload_mode=False, invalid=None): def edit_book_publisher(publishers, book): changed = False if publishers: - publisher = publishers.rstrip().strip() + publisher = strip_whitespaces(publishers) if len(book.publishers) == 0 or (len(book.publishers) > 0 and publisher != book.publishers[0].name): changed |= modify_database_object([publisher], book.publishers, db.Publishers, calibre_db.session, 'publisher') @@ -1119,7 +1119,7 @@ def edit_cc_data_string(book, c, to_save, cc_db_value, cc_string): changed = False if c.datatype == 'rating': to_save[cc_string] = str(int(float(to_save[cc_string]) * 2)) - if to_save[cc_string].strip() != cc_db_value: + if strip_whitespaces(to_save[cc_string]) != cc_db_value: if cc_db_value is not None: # remove old cc_val del_cc = getattr(book, cc_string)[0] @@ -1129,15 +1129,15 @@ def edit_cc_data_string(book, c, to_save, cc_db_value, cc_string): changed = True cc_class = db.cc_classes[c.id] new_cc = calibre_db.session.query(cc_class).filter( - cc_class.value == to_save[cc_string].strip()).first() + cc_class.value == strip_whitespaces(to_save[cc_string])).first() # if no cc val is found add it if new_cc is None: - new_cc = cc_class(value=to_save[cc_string].strip()) + new_cc = cc_class(value=strip_whitespaces(to_save[cc_string])) calibre_db.session.add(new_cc) changed = True calibre_db.session.flush() new_cc = calibre_db.session.query(cc_class).filter( - cc_class.value == to_save[cc_string].strip()).first() + cc_class.value == strip_whitespaces(to_save[cc_string])).first() # add cc value to book getattr(book, cc_string).append(new_cc) return changed, to_save @@ -1165,7 +1165,7 @@ def edit_cc_data(book_id, book, to_save, cc): cc_db_value = getattr(book, cc_string)[0].value else: cc_db_value = None - if to_save[cc_string].strip(): + if strip_whitespaces(to_save[cc_string]): if c.datatype in ['int', 'bool', 'float', "datetime", "comments"]: change, to_save = edit_cc_data_value(book_id, book, c, to_save, cc_db_value, cc_string) else: @@ -1181,7 +1181,7 @@ def edit_cc_data(book_id, book, to_save, cc): changed = True else: input_tags = to_save[cc_string].split(',') - input_tags = list(map(lambda it: it.strip(), input_tags)) + input_tags = list(map(lambda it: strip_whitespaces(it), input_tags)) changed |= modify_database_object(input_tags, getattr(book, cc_string), db.cc_classes[c.id], @@ -1284,7 +1284,7 @@ def upload_cover(cover_request, book): def handle_title_on_edit(book, book_title): # handle book title - book_title = book_title.rstrip().strip() + book_title = strip_whitespaces(book_title) if book.title != book_title: if book_title == '': book_title = _(u'Unknown') diff --git a/cps/epub.py b/cps/epub.py index c802f61df..e84822f3d 100644 --- a/cps/epub.py +++ b/cps/epub.py @@ -25,6 +25,7 @@ from . import config, logger from .helper import split_authors from .epub_helper import get_content_opf, default_ns from .constants import BookMeta +from .string_helper import strip_whitespaces log = logger.create() @@ -90,7 +91,7 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension): elif s == 'date': epub_metadata[s] = tmp[0][:10] else: - epub_metadata[s] = tmp[0].strip() + epub_metadata[s] = strip_whitespaces(tmp[0]) else: epub_metadata[s] = 'Unknown' diff --git a/cps/helper.py b/cps/helper.py index bc95762c6..39c9c3845 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -52,6 +52,7 @@ except ImportError: UnacceptableAddressException = MissingSchema = BaseException from . import calibre_db, cli_param +from .string_helper import strip_whitespaces from .tasks.convert import TaskConvert from . import logger, config, db, ub, fs from . import gdriveutils as gd @@ -118,7 +119,7 @@ def convert_book_format(book_id, calibre_path, old_book_format, new_book_format, # Texts are not lazy translated as they are supposed to get send out as is def send_test_mail(ereader_mail, user_name): for email in ereader_mail.split(','): - email = email.strip() + email = strip_whitespaces(email) WorkerThread.add(user_name, TaskEmail(_('Calibre-Web Test Email'), None, None, config.get_mail_settings(), email, N_("Test Email"), _('This Email has been sent via Calibre-Web.'))) @@ -228,7 +229,7 @@ def send_mail(book_id, book_format, convert, ereader_mail, calibrepath, user_id) link = '{}'.format(url_for('web.show_book', book_id=book_id), escape(book.title)) email_text = N_("%(book)s send to eReader", book=link) for email in ereader_mail.split(','): - email = email.strip() + email = strip_whitespaces(email) WorkerThread.add(user_id, TaskEmail(_("Send to eReader"), book.path, converted_file_name, config.get_mail_settings(), email, email_text, _('This Email has been sent via Calibre-Web.'), book.id)) @@ -252,7 +253,7 @@ def get_valid_filename(value, replace_whitespace=True, chars=128): # pipe has to be replaced with comma value = re.sub(r'[|]+', ',', value, flags=re.U) - value = value.encode('utf-8')[:chars].decode('utf-8', errors='ignore').strip() + value = strip_whitespaces(value.encode('utf-8')[:chars].decode('utf-8', errors='ignore')) if not value: raise ValueError("Filename cannot be empty") @@ -267,11 +268,11 @@ def split_authors(values): commas = author.count(',') if commas == 1: author_split = author.split(',') - authors_list.append(author_split[1].strip() + ' ' + author_split[0].strip()) + authors_list.append(strip_whitespaces(author_split[1]) + ' ' + strip_whitespaces(author_split[0])) elif commas > 1: - authors_list.extend([x.strip() for x in author.split(',')]) + authors_list.extend([strip_whitespaces(x) for x in author.split(',')]) else: - authors_list.append(author.strip()) + authors_list.append(strip_whitespaces(author)) return authors_list @@ -661,7 +662,7 @@ def check_email(email): def check_username(username): - username = username.strip() + username = strip_whitespaces(username) if ub.session.query(ub.User).filter(func.lower(ub.User.name) == username.lower()).scalar(): log.error("This username is already taken") raise Exception(_("This username is already taken")) @@ -670,14 +671,14 @@ def check_username(username): def valid_email(emails): for email in emails.split(','): - email = email.strip() - # if email is not deleted - if email: - # Regex according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#validation - if not re.search(r"^[\w.!#$%&'*+\\/=?^_`{|}~-]+@[\w](?:[\w-]{0,61}[\w])?(?:\.[\w](?:[\w-]{0,61}[\w])?)*$", - email): - log.error("Invalid Email address format") - raise Exception(_("Invalid Email address format")) + email = strip_whitespaces(email) + # if email is not deleted + if email: + # Regex according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#validation + if not re.search(r"^[\w.!#$%&'*+\\/=?^_`{|}~-]+@[\w](?:[\w-]{0,61}[\w])?(?:\.[\w](?:[\w-]{0,61}[\w])?)*$", + email): + log.error("Invalid Email address format") + raise Exception(_("Invalid Email address format")) return email diff --git a/cps/search.py b/cps/search.py index 6054ec9ec..da74984b6 100644 --- a/cps/search.py +++ b/cps/search.py @@ -24,9 +24,9 @@ from flask_babel import format_date from flask_babel import gettext as _ from sqlalchemy.sql.expression import func, not_, and_, or_, text, true from sqlalchemy.sql.functions import coalesce -from sqlalchemy import exists from . import logger, db, calibre_db, config, ub +from .string_helper import strip_whitespaces from .usermanagement import login_required_if_no_ano from .render_template import render_title_template from .pagination import Pagination @@ -267,11 +267,11 @@ def render_adv_search_results(term, offset=None, order=None, limit=None): description = term.get("comment") read_status = term.get("read_status") if author_name: - author_name = author_name.strip().lower().replace(',', '|') + author_name = strip_whitespaces(author_name).lower().replace(',', '|') if book_title: - book_title = book_title.strip().lower() + book_title = strip_whitespaces(book_title).lower() if publisher: - publisher = publisher.strip().lower() + publisher = strip_whitespaces(publisher).lower() search_term = [] cc_present = False diff --git a/cps/string_helper.py b/cps/string_helper.py new file mode 100644 index 000000000..b2d0cf81e --- /dev/null +++ b/cps/string_helper.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web) +# Copyright (C) 2024 OzzieIsaacs +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +import re + + +def strip_whitespaces(text): + return re.sub("(^[\s\u200B-\u200D\ufeff]+)|([\s\u200B-\u200D\ufeff]+$)","", text) + diff --git a/cps/tasks/convert.py b/cps/tasks/convert.py index 3bef81a99..b163ecfe6 100644 --- a/cps/tasks/convert.py +++ b/cps/tasks/convert.py @@ -39,6 +39,7 @@ from cps.file_helper import get_temp_dir from cps.tasks.mail import TaskEmail from cps import gdriveutils, helper from cps.constants import SUPPORTED_CALIBRE_BINARIES +from cps.string_helper import strip_whitespaces log = logger.create() @@ -107,7 +108,7 @@ class TaskConvert(CalibreTask): try: EmailText = N_(u"%(book)s send to E-Reader", book=escape(self.title)) for email in self.ereader_mail.split(','): - email = email.strip() + email = strip_whitespaces(email) worker_thread.add(self.user, TaskEmail(self.settings['subject'], self.results["path"], filename, diff --git a/cps/tasks/mail.py b/cps/tasks/mail.py index 4f85eefa3..f332e267b 100644 --- a/cps/tasks/mail.py +++ b/cps/tasks/mail.py @@ -34,6 +34,7 @@ from cps.services import gmail from cps.embed_helper import do_calibre_export from cps import logger, config from cps import gdriveutils +from cps.string_helper import strip_whitespaces import uuid log = logger.create() @@ -127,9 +128,9 @@ class TaskEmail(CalibreTask): try: # Parse out the address from the From line, and then the domain from that from_email = parseaddr(self.settings["mail_from"])[1] - msgid_domain = from_email.partition('@')[2].strip() + msgid_domain = strip_whitespaces(from_email.partition('@')[2]) # This can sometimes sneak through parseaddr if the input is malformed - msgid_domain = msgid_domain.rstrip('>').strip() + msgid_domain = strip_whitespaces(msgid_domain.rstrip('>')) except Exception: msgid_domain = '' return msgid_domain or 'calibre-web.com' diff --git a/cps/ub.py b/cps/ub.py index e548cc12f..5b889a72a 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -54,7 +54,7 @@ from sqlalchemy.orm import backref, relationship, sessionmaker, Session, scoped_ from werkzeug.security import generate_password_hash from . import constants, logger - +from .string_helper import strip_whitespaces log = logger.create() @@ -196,19 +196,19 @@ class UserBase: def list_denied_tags(self): mct = self.denied_tags or "" - return [t.strip() for t in mct.split(",")] + return [strip_whitespaces(t) for t in mct.split(",")] def list_allowed_tags(self): mct = self.allowed_tags or "" - return [t.strip() for t in mct.split(",")] + return [strip_whitespaces(t) for t in mct.split(",")] def list_denied_column_values(self): mct = self.denied_column_value or "" - return [t.strip() for t in mct.split(",")] + return [strip_whitespaces(t) for t in mct.split(",")] def list_allowed_column_values(self): mct = self.allowed_column_value or "" - return [t.strip() for t in mct.split(",")] + return [strip_whitespaces(t) for t in mct.split(",")] def get_view_property(self, page, prop): if not self.view_settings.get(page): diff --git a/cps/uploader.py b/cps/uploader.py index 94a0f8c05..d59142c4d 100644 --- a/cps/uploader.py +++ b/cps/uploader.py @@ -24,6 +24,7 @@ from . import logger, comic, isoLanguages from .constants import BookMeta from .helper import split_authors from .file_helper import get_temp_dir +from .string_helper import strip_whitespaces log = logger.create() @@ -97,9 +98,9 @@ def process(tmp_file_path, original_file_name, original_file_extension, rar_exec except Exception as ex: log.warning('cannot parse metadata, using default: %s', ex) - if not meta.title.strip(): + if not strip_whitespaces(meta.title): meta = meta._replace(title=original_file_name) - if not meta.author.strip() or meta.author.lower() == 'unknown': + if not strip_whitespaces(meta.author) or meta.author.lower() == 'unknown': meta = meta._replace(author=_('Unknown')) return meta diff --git a/cps/web.py b/cps/web.py index f43cdd875..7e66730e6 100644 --- a/cps/web.py +++ b/cps/web.py @@ -60,6 +60,7 @@ from . import limiter from .services.worker import WorkerThread from .tasks_status import render_task_status from .usermanagement import user_login_required +from .string_helper import strip_whitespaces feature_support = { @@ -1286,7 +1287,7 @@ def register_post(): if not config.get_mail_server_configured(): flash(_("Oops! Email server is not configured, please contact your administrator."), category="error") return render_title_template('register.html', title=_("Register"), page="register") - nickname = to_save.get("email", "").strip() if config.config_register_email else to_save.get('name') + nickname = strip_whitespaces(to_save.get("email", "")) if config.config_register_email else to_save.get('name') if not nickname or not to_save.get("email"): flash(_("Oops! Please complete all fields."), category="error") return render_title_template('register.html', title=_("Register"), page="register") @@ -1311,7 +1312,7 @@ def register_post(): ub.session.commit() if feature_support['oauth']: register_user_with_oauth(content) - send_registration_mail(to_save.get("email", "").strip(), nickname, password) + send_registration_mail(strip_whitespaces(to_save.get("email", "")), nickname, password) except Exception: ub.session.rollback() flash(_("Oops! An unknown error occurred. Please try again later."), category="error") @@ -1370,11 +1371,11 @@ def login(): @web.route('/login', methods=['POST']) -@limiter.limit("40/day", key_func=lambda: request.form.get('username', "").strip().lower()) -@limiter.limit("3/minute", key_func=lambda: request.form.get('username', "").strip().lower()) +@limiter.limit("40/day", key_func=lambda: strip_whitespaces(request.form.get('username', "")).lower()) +@limiter.limit("3/minute", key_func=lambda: strip_whitespaces(request.form.get('username', "")).lower()) def login_post(): form = request.form.to_dict() - username = form.get('username', "").strip().lower().replace("\n","").replace("\r","") + username = strip_whitespaces(form.get('username', "")).lower().replace("\n","").replace("\r","") try: limiter.check() except RateLimitExceeded: diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index 8b5335b9c..44ef1d890 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
-

Start Time: 2024-08-11 19:57:31

+

Start Time: 2024-08-12 18:42:30

-

Stop Time: 2024-08-12 03:10:54

+

Stop Time: 2024-08-13 01:57:45

-

Duration: 5h 59 min

+

Duration: 6h 1 min

@@ -4519,11 +4519,11 @@ ModuleNotFoundError: No module named 'build_release' - + TestThumbnails 8 - 6 - 1 + 7 + 0 0 1 @@ -4560,31 +4560,11 @@ ModuleNotFoundError: No module named 'build_release' - +
TestThumbnails - test_cover_change_on_upload_new_cover
- -
- FAIL -
- - - - + PASS @@ -4739,11 +4719,11 @@ AssertionError: 0.023989181595169266 not greater than or equal to 0.03 - + TestUploadAudio 12 - 11 - 1 + 12 + 0 0 0 @@ -4780,33 +4760,11 @@ AssertionError: 0.023989181595169266 not greater than or equal to 0.03 - +
TestUploadAudio - test_upload_flac
- -
- FAIL -
- - - - + PASS @@ -5849,8 +5807,8 @@ AssertionError: 'Album' != 'Flac Album' Total 519 - 506 - 2 + 508 + 0 2 9   @@ -6390,7 +6348,7 @@ AssertionError: 'Album' != 'Flac Album' From 4d79c593f768be7d04ab5b1ebcfbe6b25d6e854d Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Tue, 13 Aug 2024 19:40:32 +0200 Subject: [PATCH 4/8] Fix for #2990 (Kobo browser not downloading kepub files) --- cps/templates/detail.html | 4 ++-- cps/templates/shelfdown.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cps/templates/detail.html b/cps/templates/detail.html index bca7b1c89..b52a231b1 100644 --- a/cps/templates/detail.html +++ b/cps/templates/detail.html @@ -20,7 +20,7 @@ {{ _('Download') }} : {% for format in entry.data %} - {{ format.format }} @@ -36,7 +36,7 @@ diff --git a/cps/templates/shelfdown.html b/cps/templates/shelfdown.html index 19a42b010..cb183a037 100644 --- a/cps/templates/shelfdown.html +++ b/cps/templates/shelfdown.html @@ -55,7 +55,7 @@ {% if entry.Books.data|length %}
{% for format in entry.Books.data %} - + {{format.format}} ({{ format.uncompressed_size|filesizeformat }}) {% endfor %} From 22affedafc27013b89be357637ac66ebf4f7a877 Mon Sep 17 00:00:00 2001 From: "Daniel M. Drucker, Ph.D." Date: Tue, 13 Aug 2024 14:10:03 -0400 Subject: [PATCH 5/8] fix spelling of seperate to separate --- cps/templates/user_edit.html | 2 +- cps/translations/cs/LC_MESSAGES/messages.po | 2 +- cps/translations/de/LC_MESSAGES/messages.po | 2 +- cps/translations/el/LC_MESSAGES/messages.po | 2 +- cps/translations/es/LC_MESSAGES/messages.po | 2 +- cps/translations/fi/LC_MESSAGES/messages.po | 2 +- cps/translations/fr/LC_MESSAGES/messages.po | 2 +- cps/translations/gl/LC_MESSAGES/messages.po | 2 +- cps/translations/hu/LC_MESSAGES/messages.po | 2 +- cps/translations/id/LC_MESSAGES/messages.po | 2 +- cps/translations/it/LC_MESSAGES/messages.po | 2 +- cps/translations/ja/LC_MESSAGES/messages.po | 2 +- cps/translations/km/LC_MESSAGES/messages.po | 2 +- cps/translations/ko/LC_MESSAGES/messages.po | 2 +- cps/translations/nl/LC_MESSAGES/messages.po | 2 +- cps/translations/no/LC_MESSAGES/messages.po | 2 +- cps/translations/pl/LC_MESSAGES/messages.po | 2 +- cps/translations/pt/LC_MESSAGES/messages.po | 2 +- cps/translations/pt_BR/LC_MESSAGES/messages.po | 2 +- cps/translations/ru/LC_MESSAGES/messages.po | 2 +- cps/translations/sk/LC_MESSAGES/messages.po | 2 +- cps/translations/sv/LC_MESSAGES/messages.po | 2 +- cps/translations/tr/LC_MESSAGES/messages.po | 2 +- cps/translations/uk/LC_MESSAGES/messages.po | 2 +- cps/translations/vi/LC_MESSAGES/messages.po | 2 +- cps/translations/zh_Hans_CN/LC_MESSAGES/messages.po | 2 +- cps/translations/zh_Hant_TW/LC_MESSAGES/messages.po | 2 +- messages.pot | 2 +- 28 files changed, 28 insertions(+), 28 deletions(-) diff --git a/cps/templates/user_edit.html b/cps/templates/user_edit.html index bbb7a70de..b24c6ec06 100644 --- a/cps/templates/user_edit.html +++ b/cps/templates/user_edit.html @@ -25,7 +25,7 @@
{% endif %}
- +
{% if not content.role_anonymous() %} diff --git a/cps/translations/cs/LC_MESSAGES/messages.po b/cps/translations/cs/LC_MESSAGES/messages.po index e5640d0db..79817aed0 100644 --- a/cps/translations/cs/LC_MESSAGES/messages.po +++ b/cps/translations/cs/LC_MESSAGES/messages.po @@ -3519,7 +3519,7 @@ msgid "Reset user Password" msgstr "Resetovat uživatelské heslo" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/de/LC_MESSAGES/messages.po b/cps/translations/de/LC_MESSAGES/messages.po index 1111d7435..0123ae449 100644 --- a/cps/translations/de/LC_MESSAGES/messages.po +++ b/cps/translations/de/LC_MESSAGES/messages.po @@ -3447,7 +3447,7 @@ msgid "Reset user Password" msgstr "Benutzerpasswort zurücksetzen" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/el/LC_MESSAGES/messages.po b/cps/translations/el/LC_MESSAGES/messages.po index f3804c328..3ec45594d 100644 --- a/cps/translations/el/LC_MESSAGES/messages.po +++ b/cps/translations/el/LC_MESSAGES/messages.po @@ -3520,7 +3520,7 @@ msgid "Reset user Password" msgstr "Επαναφορά Κωδικού χρήστη" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/es/LC_MESSAGES/messages.po b/cps/translations/es/LC_MESSAGES/messages.po index 9bd88a1f5..8b86ab310 100644 --- a/cps/translations/es/LC_MESSAGES/messages.po +++ b/cps/translations/es/LC_MESSAGES/messages.po @@ -3528,7 +3528,7 @@ msgid "Reset user Password" msgstr "Resetear contraseña de usuario" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/fi/LC_MESSAGES/messages.po b/cps/translations/fi/LC_MESSAGES/messages.po index 237819ed1..152d04ea3 100644 --- a/cps/translations/fi/LC_MESSAGES/messages.po +++ b/cps/translations/fi/LC_MESSAGES/messages.po @@ -3507,7 +3507,7 @@ msgid "Reset user Password" msgstr "Nollaa käyttäjän salasana" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/fr/LC_MESSAGES/messages.po b/cps/translations/fr/LC_MESSAGES/messages.po index 1065296ef..8ab4715c5 100644 --- a/cps/translations/fr/LC_MESSAGES/messages.po +++ b/cps/translations/fr/LC_MESSAGES/messages.po @@ -3540,7 +3540,7 @@ msgid "Reset user Password" msgstr "Réinitialiser le mot de passe de l’utilisateur" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/gl/LC_MESSAGES/messages.po b/cps/translations/gl/LC_MESSAGES/messages.po index 3d852d6f7..0be7e614c 100644 --- a/cps/translations/gl/LC_MESSAGES/messages.po +++ b/cps/translations/gl/LC_MESSAGES/messages.po @@ -3487,7 +3487,7 @@ msgid "Reset user Password" msgstr "Restablecer contrasinal de usuario" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/hu/LC_MESSAGES/messages.po b/cps/translations/hu/LC_MESSAGES/messages.po index a2597fd2a..4080e40fa 100644 --- a/cps/translations/hu/LC_MESSAGES/messages.po +++ b/cps/translations/hu/LC_MESSAGES/messages.po @@ -3500,7 +3500,7 @@ msgid "Reset user Password" msgstr "Felhasználó jelszavának alaphelyzetbe állítása" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/id/LC_MESSAGES/messages.po b/cps/translations/id/LC_MESSAGES/messages.po index 2de7c78dd..6e6054e94 100644 --- a/cps/translations/id/LC_MESSAGES/messages.po +++ b/cps/translations/id/LC_MESSAGES/messages.po @@ -3490,7 +3490,7 @@ msgid "Reset user Password" msgstr "Atur ulang kata sandi pengguna" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/it/LC_MESSAGES/messages.po b/cps/translations/it/LC_MESSAGES/messages.po index 1e066eef5..7950f9c5d 100644 --- a/cps/translations/it/LC_MESSAGES/messages.po +++ b/cps/translations/it/LC_MESSAGES/messages.po @@ -3441,7 +3441,7 @@ msgid "Reset user Password" msgstr "Reimposta la password dell'utente" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "Invia all'indirizzo e-mail dell'eReader. Usa la virgola per separare le email per più eReader" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/ja/LC_MESSAGES/messages.po b/cps/translations/ja/LC_MESSAGES/messages.po index 0e884de36..9c60f57bf 100644 --- a/cps/translations/ja/LC_MESSAGES/messages.po +++ b/cps/translations/ja/LC_MESSAGES/messages.po @@ -3490,7 +3490,7 @@ msgid "Reset user Password" msgstr "パスワードをリセット" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/km/LC_MESSAGES/messages.po b/cps/translations/km/LC_MESSAGES/messages.po index e8780b575..cfd59b909 100644 --- a/cps/translations/km/LC_MESSAGES/messages.po +++ b/cps/translations/km/LC_MESSAGES/messages.po @@ -3488,7 +3488,7 @@ msgid "Reset user Password" msgstr "" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/ko/LC_MESSAGES/messages.po b/cps/translations/ko/LC_MESSAGES/messages.po index 2ca17be94..33a41acc7 100644 --- a/cps/translations/ko/LC_MESSAGES/messages.po +++ b/cps/translations/ko/LC_MESSAGES/messages.po @@ -3495,7 +3495,7 @@ msgid "Reset user Password" msgstr "사용자 비밀번호 초기화" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/nl/LC_MESSAGES/messages.po b/cps/translations/nl/LC_MESSAGES/messages.po index d932bd55c..7ba014dac 100644 --- a/cps/translations/nl/LC_MESSAGES/messages.po +++ b/cps/translations/nl/LC_MESSAGES/messages.po @@ -3525,7 +3525,7 @@ msgid "Reset user Password" msgstr "Gebruikerswachtwoord herstellen" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/no/LC_MESSAGES/messages.po b/cps/translations/no/LC_MESSAGES/messages.po index 89ba209ee..a46b979be 100644 --- a/cps/translations/no/LC_MESSAGES/messages.po +++ b/cps/translations/no/LC_MESSAGES/messages.po @@ -3554,7 +3554,7 @@ msgid "Reset user Password" msgstr "" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/pl/LC_MESSAGES/messages.po b/cps/translations/pl/LC_MESSAGES/messages.po index 69527911e..11fd64e6f 100644 --- a/cps/translations/pl/LC_MESSAGES/messages.po +++ b/cps/translations/pl/LC_MESSAGES/messages.po @@ -3542,7 +3542,7 @@ msgid "Reset user Password" msgstr "Zresetuj hasło użytkownika" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/pt/LC_MESSAGES/messages.po b/cps/translations/pt/LC_MESSAGES/messages.po index 0dde85e40..e49ff0ac7 100644 --- a/cps/translations/pt/LC_MESSAGES/messages.po +++ b/cps/translations/pt/LC_MESSAGES/messages.po @@ -3487,7 +3487,7 @@ msgid "Reset user Password" msgstr "Redefinir senha do utilizador" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/pt_BR/LC_MESSAGES/messages.po b/cps/translations/pt_BR/LC_MESSAGES/messages.po index 2e5d9ffa6..1f2dca0b6 100644 --- a/cps/translations/pt_BR/LC_MESSAGES/messages.po +++ b/cps/translations/pt_BR/LC_MESSAGES/messages.po @@ -3487,7 +3487,7 @@ msgid "Reset user Password" msgstr "Redefinir senha do usuário" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/ru/LC_MESSAGES/messages.po b/cps/translations/ru/LC_MESSAGES/messages.po index 183ce0ff9..5b430f9e9 100644 --- a/cps/translations/ru/LC_MESSAGES/messages.po +++ b/cps/translations/ru/LC_MESSAGES/messages.po @@ -3517,7 +3517,7 @@ msgid "Reset user Password" msgstr "Сбросить пароль пользователя" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/sk/LC_MESSAGES/messages.po b/cps/translations/sk/LC_MESSAGES/messages.po index 0a4ad7f4d..d7e2fb0bb 100644 --- a/cps/translations/sk/LC_MESSAGES/messages.po +++ b/cps/translations/sk/LC_MESSAGES/messages.po @@ -3455,7 +3455,7 @@ msgid "Reset user Password" msgstr "Resetovať heslo používateľa" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/sv/LC_MESSAGES/messages.po b/cps/translations/sv/LC_MESSAGES/messages.po index 9cf5dd742..77a9fc3cb 100644 --- a/cps/translations/sv/LC_MESSAGES/messages.po +++ b/cps/translations/sv/LC_MESSAGES/messages.po @@ -3519,7 +3519,7 @@ msgid "Reset user Password" msgstr "Återställ användarlösenordet" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/tr/LC_MESSAGES/messages.po b/cps/translations/tr/LC_MESSAGES/messages.po index 210f95fbd..6bdd3b972 100644 --- a/cps/translations/tr/LC_MESSAGES/messages.po +++ b/cps/translations/tr/LC_MESSAGES/messages.po @@ -3504,7 +3504,7 @@ msgid "Reset user Password" msgstr "Kullanıcı şifresini sıfırla" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/uk/LC_MESSAGES/messages.po b/cps/translations/uk/LC_MESSAGES/messages.po index 7eb81f3b4..8a801ba62 100644 --- a/cps/translations/uk/LC_MESSAGES/messages.po +++ b/cps/translations/uk/LC_MESSAGES/messages.po @@ -3489,7 +3489,7 @@ msgid "Reset user Password" msgstr "Скинути пароль користувача" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/vi/LC_MESSAGES/messages.po b/cps/translations/vi/LC_MESSAGES/messages.po index 8cb2479ce..a90108a06 100644 --- a/cps/translations/vi/LC_MESSAGES/messages.po +++ b/cps/translations/vi/LC_MESSAGES/messages.po @@ -3487,7 +3487,7 @@ msgid "Reset user Password" msgstr "Reset mật khẩu người dùng" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/zh_Hans_CN/LC_MESSAGES/messages.po b/cps/translations/zh_Hans_CN/LC_MESSAGES/messages.po index 9ce2be5b8..3c5b57be5 100644 --- a/cps/translations/zh_Hans_CN/LC_MESSAGES/messages.po +++ b/cps/translations/zh_Hans_CN/LC_MESSAGES/messages.po @@ -3455,7 +3455,7 @@ msgid "Reset user Password" msgstr "重置用户密码" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/cps/translations/zh_Hant_TW/LC_MESSAGES/messages.po b/cps/translations/zh_Hant_TW/LC_MESSAGES/messages.po index 84ed5e6cd..01226fc03 100644 --- a/cps/translations/zh_Hant_TW/LC_MESSAGES/messages.po +++ b/cps/translations/zh_Hant_TW/LC_MESSAGES/messages.po @@ -3503,7 +3503,7 @@ msgid "Reset user Password" msgstr "重置用戶密碼" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 diff --git a/messages.pot b/messages.pot index 73212ebe8..786497e6c 100644 --- a/messages.pot +++ b/messages.pot @@ -3440,7 +3440,7 @@ msgid "Reset user Password" msgstr "" #: cps/templates/user_edit.html:28 -msgid "Send to eReader Email Address. Use comma to seperate emails for multiple eReaders" +msgid "Send to eReader Email Address. Use comma to separate emails for multiple eReaders" msgstr "" #: cps/templates/user_edit.html:43 From a9359bc1db39047eba705c26f5a6d0c96f9e24d0 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Wed, 14 Aug 2024 18:23:30 +0200 Subject: [PATCH 6/8] Removed accidentally added translation file --- cps/templates/locales/en/translation.json | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 cps/templates/locales/en/translation.json diff --git a/cps/templates/locales/en/translation.json b/cps/templates/locales/en/translation.json deleted file mode 100644 index 655669eeb..000000000 --- a/cps/templates/locales/en/translation.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "input": { - "placeholder": "a placeholder" - }, - "nav": { - "home": "Home", - "page1": "Page One", - "page2": "Page Two" - } -} \ No newline at end of file From 88783257b4b7e10fdd24efd15bf5350e9e6a09d2 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Thu, 15 Aug 2024 19:08:08 +0200 Subject: [PATCH 7/8] Update readme --- README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.md b/README.md index a400b3b20..614e27c1f 100755 --- a/README.md +++ b/README.md @@ -1,10 +1,3 @@ -# Short Notice from the maintainer - -After 6 years of more or less intensive programming on Calibre-Web, I need a break. -The last few months, maintaining Calibre-Web has felt more like work than a hobby. I felt pressured and teased by people to solve "their" problems and merge PRs for "their" Calibre-Web. -I have turned off all notifications from Github/Discord and will now concentrate undisturbed on the development of “my” Calibre-Web over the next few weeks/months. -I will look into the issues and maybe also the PRs from time to time, but don't expect a quick response from me. - # Calibre-Web Calibre-Web is a web app that offers a clean and intuitive interface for browsing, reading, and downloading eBooks using a valid [Calibre](https://calibre-ebook.com) database. From 4c01af340f9aca2106d88df589dc0227e8507f35 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Fri, 16 Aug 2024 09:31:59 +0200 Subject: [PATCH 8/8] Update Testresults --- test/Calibre-Web TestSummary_Linux.html | 1008 +++++++++++++++-------- 1 file changed, 670 insertions(+), 338 deletions(-) diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index 44ef1d890..ed5f51343 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
-

Start Time: 2024-08-12 18:42:30

+

Start Time: 2024-08-15 19:27:26

-

Stop Time: 2024-08-13 01:57:45

+

Stop Time: 2024-08-16 02:42:05

-

Duration: 6h 1 min

+

Duration: 6h 5 min

@@ -852,11 +852,11 @@ - + TestEbookConvertCalibreGDrive 7 - 7 - 0 + 6 + 1 0 0 @@ -920,53 +920,114 @@ - +
TestEbookConvertCalibreGDrive - test_thumbnail_cache
- PASS + +
+ FAIL +
+ + + + - - TestEbookConvertKepubify - 3 - 3 + + _FailedTest + 2 0 0 + 2 0 - Detail + Detail - + -
TestEbookConvertKepubify - test_convert_deactivate
+
_FailedTest - test_ebook_convert_kepubify
+ + +
+ ERROR +
+ + + - PASS - + -
TestEbookConvertKepubify - test_convert_only
+
_FailedTest - test_pip_install
- PASS - - - - - - -
TestEbookConvertKepubify - test_convert_wrong_excecutable
+ +
+ ERROR +
+ + + - PASS @@ -2837,11 +2898,11 @@ IndexError: list index out of range - + TestKoboSyncBig 6 - 6 - 0 + 5 + 1 0 0 @@ -2851,11 +2912,31 @@ IndexError: list index out of range - +
TestKoboSyncBig - test_download_cover
- PASS + +
+ FAIL +
+ + + + @@ -3895,55 +3976,6 @@ IndexError: list index out of range - - _FailedTest - 1 - 0 - 0 - 1 - 0 - - Detail - - - - - - - -
_FailedTest - test_pip_install
- - -
- ERROR -
- - - - - - - - - TestReader 8 @@ -3952,13 +3984,13 @@ ModuleNotFoundError: No module named 'build_release' 0 1 - Detail + Detail - +
TestReader - test_cb7_reader
@@ -3967,7 +3999,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestReader - test_comic_MACOS_files
@@ -3976,7 +4008,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestReader - test_comic_reader
@@ -3985,7 +4017,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestReader - test_epub_reader
@@ -3994,7 +4026,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestReader - test_pdf_reader
@@ -4003,7 +4035,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestReader - test_single_file_comic
@@ -4012,7 +4044,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestReader - test_sound_listener
@@ -4021,7 +4053,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestReader - test_txt_reader
@@ -4039,13 +4071,13 @@ ModuleNotFoundError: No module named 'build_release' 0 0 - Detail + Detail - +
TestReadOnlyDatabase - test_readonly_path
@@ -4063,13 +4095,13 @@ ModuleNotFoundError: No module named 'build_release' 0 0 - Detail + Detail - +
TestRegister - test_forgot_password
@@ -4078,7 +4110,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestRegister - test_illegal_email
@@ -4087,7 +4119,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestRegister - test_limit_domain
@@ -4096,7 +4128,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestRegister - test_register_no_server
@@ -4105,7 +4137,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestRegister - test_registering_only_email
@@ -4114,7 +4146,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestRegister - test_registering_user
@@ -4123,7 +4155,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestRegister - test_registering_user_fail
@@ -4132,7 +4164,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestRegister - test_user_change_password
@@ -4150,13 +4182,13 @@ ModuleNotFoundError: No module named 'build_release' 0 0 - Detail + Detail - +
TestReverseProxy - test_logout
@@ -4165,7 +4197,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestReverseProxy - test_move_page
@@ -4174,7 +4206,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestReverseProxy - test_next
@@ -4183,7 +4215,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestReverseProxy - test_reverse_about
@@ -4201,13 +4233,13 @@ ModuleNotFoundError: No module named 'build_release' 0 1 - Detail + Detail - +
TestShelf - test_access_shelf
@@ -4216,7 +4248,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestShelf - test_add_shelf_from_search
@@ -4225,7 +4257,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestShelf - test_adv_search_shelf
@@ -4234,7 +4266,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestShelf - test_arrange_shelf
@@ -4243,7 +4275,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestShelf - test_create_public_shelf
@@ -4252,7 +4284,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestShelf - test_create_public_shelf_no_permission
@@ -4261,7 +4293,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestShelf - test_delete_book_of_shelf
@@ -4270,7 +4302,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestShelf - test_private_shelf
@@ -4279,7 +4311,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestShelf - test_public_private_shelf
@@ -4288,7 +4320,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestShelf - test_public_shelf
@@ -4297,7 +4329,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestShelf - test_rename_shelf
@@ -4306,7 +4338,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestShelf - test_shelf_action_non_shelf_edit_role
@@ -4315,7 +4347,7 @@ ModuleNotFoundError: No module named 'build_release' - +
TestShelf - test_shelf_anonymous
@@ -4324,19 +4356,19 @@ ModuleNotFoundError: No module named 'build_release' - +
TestShelf - test_shelf_database_change
- SKIP + SKIP
-