diff --git a/cps/editbooks.py b/cps/editbooks.py index 80e73697..6eefc61f 100644 --- a/cps/editbooks.py +++ b/cps/editbooks.py @@ -455,7 +455,7 @@ def do_edit_book(book_id, upload_formats=None): # Update folder of book on local disk edited_books_id = None title_author_error = None - upload_mode = False + # upload_mode = False # handle book title change if "title" in to_save: title_change = handle_title_on_edit(book, to_save["title"]) @@ -1005,7 +1005,7 @@ def edit_book_ratings(to_save, book): def edit_book_tags(tags, book): - if tags: + if tags is not None: input_tags = tags.split(',') input_tags = list(map(lambda it: strip_whitespaces(it), input_tags)) # Remove duplicates @@ -1014,7 +1014,7 @@ def edit_book_tags(tags, book): return False def edit_book_series(series, book): - if series: + if series is not None: 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') @@ -1054,10 +1054,13 @@ def edit_book_comments(comments, book): def edit_book_languages(languages, book, upload_mode=False, invalid=None): - if languages: + if languages is not None: input_languages = languages.split(',') unknown_languages = [] - input_l = isoLanguages.get_language_code_from_name(get_locale(), input_languages, unknown_languages) + if not upload_mode: + input_l = isoLanguages.get_language_code_from_name(get_locale(), input_languages, unknown_languages) + else: + input_l = isoLanguages.get_valid_language_codes_from_code(get_locale(), input_languages, unknown_languages) for lang in unknown_languages: log.error("'%s' is not a valid language", lang) if isinstance(invalid, list): @@ -1078,7 +1081,7 @@ def edit_book_languages(languages, book, upload_mode=False, invalid=None): def edit_book_publisher(publishers, book): - if publishers: + if publishers is not None: changed = False if publishers: publisher = strip_whitespaces(publishers) @@ -1169,7 +1172,7 @@ def edit_cc_data(book_id, book, to_save, cc): changed = False for c in cc: cc_string = "custom_column_" + str(c.id) - if to_save.get(cc_string): + if to_save.get(cc_string) is not None: if not c.is_multiple: if len(getattr(book, cc_string)) > 0: cc_db_value = getattr(book, cc_string)[0].value @@ -1279,11 +1282,11 @@ def upload_book_formats(requested_files, book, book_id, no_cover=True): rar_executable=config.config_rarfile_location, no_cover=no_cover) merge_metadata(book, meta, to_save) - if to_save.get('languages'): - langs = [] - for lang_code in to_save['languages']: - langs.append(isoLanguages.get_language_name(get_locale(), lang_code)) - to_save['languages'] = ",".join(langs) + #if to_save.get('languages'): + # langs = [] + # for lang_code in to_save['languages'].split(','): + # langs.append(isoLanguages.get_language_name(get_locale(), lang_code)) + # to_save['languages'] = ",".join(langs) return to_save, error diff --git a/cps/search.py b/cps/search.py index 29dda16d..8cdb9b4a 100644 --- a/cps/search.py +++ b/cps/search.py @@ -265,7 +265,7 @@ def render_adv_search_results(term, offset=None, order=None, limit=None): pub_end = term.get("publishend") rating_low = term.get("ratinghigh") rating_high = term.get("ratinglow") - description = term.get("comments") + description = term.get("comment") read_status = term.get("read_status") if author_name: author_name = strip_whitespaces(author_name).lower().replace(',', '|') diff --git a/cps/templates/search_form.html b/cps/templates/search_form.html index 58585d28..bdd8d8fc 100644 --- a/cps/templates/search_form.html +++ b/cps/templates/search_form.html @@ -151,8 +151,8 @@
- - + +
{% if cc|length > 0 %} diff --git a/requirements.txt b/requirements.txt index 1207e148..71074892 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ Babel>=1.3,<3.0 Flask-Babel>=0.11.1,<4.1.0 Flask-Principal>=0.3.2,<0.5.1 Flask>=1.0.2,<3.1.0 -# iso-639>=0.4.5,<0.5.0 # alternative pycountry +iso-639>=0.4.5,<0.5.0 PyPDF>=3.15.6,<4.3.0 pytz>=2016.10 requests>=2.28.0,<2.32.0 diff --git a/setup.cfg b/setup.cfg index 2d326d62..ee1c63c5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -101,6 +101,7 @@ metadata = faust-cchardet>=2.1.18,<2.1.20 py7zr>=0.15.0,<0.21.0 mutagen>=1.40.0,<1.50.0 + pycountry>=20.0.0,<25.0.0 comics = natsort>=2.2.0,<8.5.0 comicapi>=2.2.0,<3.3.0 diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index 145bf9a7..387b60e6 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
-

Start Time: 2024-08-16 21:16:11

+

Start Time: 2024-08-20 20:27:17

-

Stop Time: 2024-08-17 04:31:06

+

Stop Time: 2024-08-21 03:36:02

-

Duration: 6h 5 min

+

Duration: 6h 2 min

@@ -852,11 +852,11 @@ - + TestEbookConvertCalibreGDrive 7 - 6 - 1 + 7 + 0 0 0 @@ -920,31 +920,11 @@ - +
TestEbookConvertCalibreGDrive - test_thumbnail_cache
- -
- FAIL -
- - - - + PASS @@ -1043,12 +1023,12 @@ AssertionError: 25 != 30 - + TestEditAdditionalBooks 20 - 16 + 18 + 0 0 - 2 2 Detail @@ -1084,76 +1064,20 @@ AssertionError: 25 != 30 - +
TestEditAdditionalBooks - test_delete_role
- -
- ERROR -
- - - - + PASS - +
TestEditAdditionalBooks - test_details_popup
- -
- ERROR -
- - - - + PASS @@ -1772,11 +1696,11 @@ IndexError: list index out of range - + TestEditAuthorsGdrive 7 - 6 - 1 + 7 + 0 0 0 @@ -1840,38 +1764,11 @@ IndexError: list index out of range - +
TestEditAuthorsGdrive - test_rename_capital_on_upload
- -
- FAIL -
- - - - + PASS @@ -2203,11 +2100,11 @@ IndexError: list index out of range - + TestEditBooksOnGdrive 18 - 18 - 0 + 17 + 1 0 0 @@ -2370,11 +2267,31 @@ IndexError: list index out of range - +
TestEditBooksOnGdrive - test_watch_metadata
- PASS + +
+ FAIL +
+ + + + @@ -2524,11 +2441,11 @@ IndexError: list index out of range - + TestEmbedMetadata 6 - 6 - 0 + 5 + 1 0 0 @@ -2583,11 +2500,33 @@ IndexError: list index out of range - +
TestEmbedMetadata - test_email_epub_embed_metadata
- PASS + +
+ FAIL +
+ + + + @@ -4007,50 +3946,43 @@ IndexError: list index out of range - - _FailedTest - 1 + + TestPipInstall + 3 + 3 0 0 - 1 0 - Detail + Detail - + -
_FailedTest - test_pip_install
+
TestPipInstall - test_command_start
- -
- ERROR -
- - - + PASS + + + + + + +
TestPipInstall - test_foldername_database_location
+ PASS + + + + + + +
TestPipInstall - test_module_start
+ + PASS @@ -4167,88 +4099,53 @@ ModuleNotFoundError: No module named 'build_release' - - TestRegister - 8 - 8 + + _ErrorHolder + 1 0 0 + 1 0 - Detail + Detail - + -
TestRegister - test_forgot_password
+
setUpClass (test_register)
- PASS - - - - - - -
TestRegister - test_illegal_email
+ +
+ ERROR +
+ + + - PASS - - - - - - -
TestRegister - test_limit_domain
- - PASS - - - - - - -
TestRegister - test_register_no_server
- - PASS - - - - - - -
TestRegister - test_registering_only_email
- - PASS - - - - - - -
TestRegister - test_registering_user
- - PASS - - - - - - -
TestRegister - test_registering_user_fail
- - PASS - - - - - - -
TestRegister - test_user_change_password
- - PASS @@ -4505,12 +4402,12 @@ ModuleNotFoundError: No module named 'build_release' - + TestSplitLibrary 7 - 7 - 0 + 6 0 + 1 0 Detail @@ -4546,11 +4443,39 @@ ModuleNotFoundError: No module named 'build_release' - +
TestSplitLibrary - test_email_ebook
- PASS + +
+ ERROR +
+ + + + @@ -4607,13 +4532,13 @@ ModuleNotFoundError: No module named 'build_release' - + TestThumbnailsEnv 1 - 0 1 0 0 + 0 Detail @@ -4621,41 +4546,21 @@ ModuleNotFoundError: No module named 'build_release' - +
TestThumbnailsEnv - test_cover_cache_env_on_database_change
- -
- FAIL -
- - - - + PASS - + TestThumbnails 8 - 7 - 0 + 6 + 1 0 1 @@ -4728,21 +4633,41 @@ AssertionError: 30 != 20 - +
TestThumbnails - test_sideloaded_book
- PASS + +
+ FAIL +
+ + + + - + TestUpdater 9 - 7 - 1 + 8 + 0 0 1 @@ -4788,31 +4713,11 @@ AssertionError: 30 != 20 - +
TestUpdater - test_perform_update
- -
- FAIL -
- - - - + PASS @@ -5958,10 +5863,10 @@ AssertionError: 20 != 30 Total - 520 - 503 - 4 - 4 + 515 + 500 + 3 + 3 9   @@ -6158,7 +6063,7 @@ AssertionError: 20 != 30 google-api-python-client - 2.141.0 + 2.142.0 TestBackupMetadataGdrive @@ -6188,7 +6093,7 @@ AssertionError: 20 != 30 google-api-python-client - 2.141.0 + 2.142.0 TestCliGdrivedb @@ -6218,7 +6123,7 @@ AssertionError: 20 != 30 google-api-python-client - 2.141.0 + 2.142.0 TestEbookConvertCalibreGDrive @@ -6248,7 +6153,7 @@ AssertionError: 20 != 30 google-api-python-client - 2.141.0 + 2.142.0 TestEbookConvertGDriveKepubify @@ -6296,7 +6201,7 @@ AssertionError: 20 != 30 google-api-python-client - 2.141.0 + 2.142.0 TestEditAuthorsGdrive @@ -6332,7 +6237,7 @@ AssertionError: 20 != 30 google-api-python-client - 2.141.0 + 2.142.0 TestEditBooksOnGdrive @@ -6374,7 +6279,7 @@ AssertionError: 20 != 30 google-api-python-client - 2.141.0 + 2.142.0 TestEmbedMetadataGdrive @@ -6404,7 +6309,7 @@ AssertionError: 20 != 30 google-api-python-client - 2.141.0 + 2.142.0 TestSetupGdrive @@ -6500,7 +6405,7 @@ AssertionError: 20 != 30