From a3f7dc2a5ab6bd8e56d2c443ae81755ea1cacc32 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 23 Jul 2022 07:23:13 +0200 Subject: [PATCH] Bugfix search with wrong custom column configured --- cps/metadata_provider/scholar.py | 2 + cps/search.py | 3 + optional-requirements.txt | 6 +- setup.cfg | 2 +- test/Calibre-Web TestSummary_Linux.html | 817 ++++++------------------ 5 files changed, 198 insertions(+), 632 deletions(-) diff --git a/cps/metadata_provider/scholar.py b/cps/metadata_provider/scholar.py index 7feb0ee9..498184ec 100644 --- a/cps/metadata_provider/scholar.py +++ b/cps/metadata_provider/scholar.py @@ -49,6 +49,8 @@ class scholar(Metadata): tokens = [quote(t.encode("utf-8")) for t in title_tokens] query = " ".join(tokens) try: + scholarly.set_timeout(20) + scholarly.set_retries(2) scholar_gen = itertools.islice(scholarly.search_pubs(query), 10) except Exception as e: log.warning(e) diff --git a/cps/search.py b/cps/search.py index 88d790fc..17d54b4e 100644 --- a/cps/search.py +++ b/cps/search.py @@ -134,6 +134,9 @@ def adv_search_read_status(read_status): db_filter = coalesce(db.cc_classes[config.config_read_column].value, False) != True except (KeyError, AttributeError, IndexError): log.error("Custom Column No.{} does not exist in calibre database".format(config.config_read_column)) + flash(_("Custom Column No.%(column)d does not exist in calibre database", + column=config.config_read_column), + category="error") return true() return db_filter diff --git a/optional-requirements.txt b/optional-requirements.txt index 97f355f2..d18463a3 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -29,11 +29,11 @@ SQLAlchemy-Utils>=0.33.5,<0.39.0 # metadata extraction rarfile>=3.2 -scholarly>=1.2.0,<1.7 +scholarly>=1.2.0,<1.8 markdown2>=2.0.0,<2.5.0 html2text>=2020.1.16,<2022.1.1 python-dateutil>=2.1,<2.9.0 -beautifulsoup4>=4.0.1,<4.11.0 +beautifulsoup4>=4.0.1,<4.12.0 cchardet>=2.0.0,<2.2.0 # Comics @@ -41,4 +41,4 @@ natsort>=2.2.0,<8.2.0 comicapi>=2.2.0,<2.3.0 # Kobo integration -jsonschema>=3.2.0,<4.7.0 +jsonschema>=3.2.0,<4.8.0 diff --git a/setup.cfg b/setup.cfg index 92e64f6a..c24dfc97 100644 --- a/setup.cfg +++ b/setup.cfg @@ -97,5 +97,5 @@ comics = natsort>=2.2.0,<8.2.0 comicapi>=2.2.0,<2.3.0 kobo = - jsonschema>=3.2.0,<4.6.0 + jsonschema>=3.2.0,<4.7.0 diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index 8953c08c..7abc8792 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
-

Start Time: 2022-06-05 22:14:00

+

Start Time: 2022-07-18 11:00:52

-

Stop Time: 2022-06-06 04:06:43

+

Stop Time: 2022-07-18 17:02:49

-

Duration: 4h 57 min

+

Duration: 5h 1 min

@@ -465,13 +465,13 @@ - + TestEbookConvertCalibre 15 - 11 - 3 + 14 1 0 + 0 Detail @@ -479,11 +479,31 @@ - +
TestEbookConvertCalibre - test_calibre_log
- PASS + +
+ FAIL +
+ + + + @@ -497,64 +517,20 @@ - +
TestEbookConvertCalibre - test_convert_email
- -
- FAIL -
- - - - + PASS - +
TestEbookConvertCalibre - test_convert_failed_and_email
- -
- ERROR -
- - - - + PASS @@ -568,33 +544,11 @@ selenium.common.exceptions.NoSuchElementException: Message: Could not locate ele - +
TestEbookConvertCalibre - test_convert_options
- -
- FAIL -
- - - - + PASS @@ -635,33 +589,11 @@ AssertionError: Items in the first set but not the second: - +
TestEbookConvertCalibre - test_email_only
- -
- FAIL -
- - - - + PASS @@ -703,12 +635,12 @@ AssertionError: 'Failed' != 'Finished' - + TestEbookConvertCalibreGDrive 6 - 3 - 2 - 1 + 6 + 0 + 0 0 Detail @@ -717,64 +649,20 @@ AssertionError: 'Failed' != 'Finished' - +
TestEbookConvertCalibreGDrive - test_convert_email
- -
- FAIL -
- - - - + PASS - +
TestEbookConvertCalibreGDrive - test_convert_failed_and_email
- -
- ERROR -
- - - - + PASS @@ -806,33 +694,11 @@ selenium.common.exceptions.NoSuchElementException: Message: Could not locate ele - +
TestEbookConvertCalibreGDrive - test_email_only
- -
- FAIL -
- - - - + PASS @@ -1951,9 +1817,9 @@ AssertionError: 'Failed' != 'Finished'
Traceback (most recent call last):
-  File "/home/ozzie/Development/calibre-web-test/test/test_edit_ebooks_gdrive.py", line 185, in test_edit_title
-    self.assertEqual('The camicdemo', books[1][8]['title'])
-IndexError: list index out of range
+ File "/home/ozzie/Development/calibre-web-test/test/test_edit_ebooks_gdrive.py", line 230, 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'
@@ -1982,11 +1848,11 @@ IndexError: list index out of range - + TestLoadMetadataScholar 1 - 1 0 + 1 0 0 @@ -1996,90 +1862,26 @@ IndexError: list index out of range - +
TestLoadMetadataScholar - test_load_metadata
- PASS - - - - - - - TestSTARTTLS - 3 - 1 - 2 - 0 - 0 - - Detail - - - - - - - -
TestSTARTTLS - test_STARTTLS
-
- FAIL + FAIL
-