From 59a5ccd05cb9b0283a4a7ed687c5988b2294fd4e Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 24 Sep 2022 06:46:24 +0200 Subject: [PATCH] Bugfixes after testrun --- cps/db.py | 16 +- cps/epub.py | 10 +- cps/schedule.py | 2 +- cps/ub.py | 1 + setup.cfg | 4 +- test/Calibre-Web TestSummary_Linux.html | 419 +++++++++++++----------- 6 files changed, 242 insertions(+), 210 deletions(-) diff --git a/cps/db.py b/cps/db.py index fbb458e6..aaedcd06 100644 --- a/cps/db.py +++ b/cps/db.py @@ -53,7 +53,7 @@ from weakref import WeakSet log = logger.create() -cc_exceptions = ['composite'] +cc_exceptions = ['composite', 'series'] cc_classes = {} Base = declarative_base() @@ -472,7 +472,6 @@ class CalibreDB: # This is a WeakSet so that references here don't keep other CalibreDB # instances alive once they reach the end of their respective scopes instances = WeakSet() - series = False def __init__(self, expire_on_commit=True, init=False): """ Initialize a new CalibreDB session @@ -500,7 +499,6 @@ class CalibreDB: for row in cc: if row.datatype not in cc_exceptions: if row.datatype == 'series': - cls.series = True dicttable = {'__tablename__': 'books_custom_column_' + str(row.id) + '_link', 'id': Column(Integer, primary_key=True), 'book': Column(Integer, ForeignKey('books.id'), @@ -1029,14 +1027,10 @@ class CalibreDB: Base.metadata.remove(table) def reconnect_db(self, config, app_db_path): - if self.series: - from . import isoLanguages, web_server - web_server.stop(True) - else: - self.dispose() - self.engine.dispose() - self.setup_db(config.config_calibre_dir, app_db_path) - self.update_config(config) + self.dispose() + self.engine.dispose() + self.setup_db(config.config_calibre_dir, app_db_path) + self.update_config(config) def lcase(s): diff --git a/cps/epub.py b/cps/epub.py index d358d038..00ce907b 100644 --- a/cps/epub.py +++ b/cps/epub.py @@ -102,11 +102,11 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension): identifiers = [] for node in p.xpath('dc:identifier', namespaces=ns): - identifier_name=node.attrib.values()[-1]; - identifier_value=node.text; - if identifier_name in ('uuid','calibre'): - continue; - identifiers.append( [identifier_name, identifier_value] ) + identifier_name = node.attrib.values()[-1] + identifier_value = node.text + if identifier_name in ('uuid', 'calibre') or identifier_value is None: + continue + identifiers.append([identifier_name, identifier_value]) if not epub_metadata['title']: title = original_file_name diff --git a/cps/schedule.py b/cps/schedule.py index 44bb2c27..5f3326ef 100644 --- a/cps/schedule.py +++ b/cps/schedule.py @@ -33,7 +33,7 @@ def get_scheduled_tasks(reconnect=True): tasks.append([lambda: TaskReconnectDatabase(), 'reconnect', False]) # ToDo make configurable. Generate metadata.opf file for each changed book - if True: + if False: tasks.append([lambda: TaskBackupMetadata("en"), 'backup metadata', False]) # Generate all missing book cover thumbnails diff --git a/cps/ub.py b/cps/ub.py index 96e674d4..5dd7d646 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -796,6 +796,7 @@ def create_anonymous_user(_session): def create_admin_user(_session): user = User() user.name = "admin" + user.email = "admin@example.org" user.role = constants.ADMIN_USER_ROLES user.sidebar_view = constants.ADMIN_USER_SIDEBAR diff --git a/setup.cfg b/setup.cfg index de4e4714..1c531d48 100644 --- a/setup.cfg +++ b/setup.cfg @@ -47,7 +47,7 @@ install_requires = backports_abc>=0.4 Flask>=1.0.2,<2.1.0 iso-639>=0.4.5,<0.5.0 - PyPDF3>=1.0.0,<1.0.7 + PyPDF2>=1.20,<2.11.0 pytz>=2016.10 requests>=2.11.1,<2.28.0 SQLAlchemy>=1.3.0,<1.5.0 @@ -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.8.0 + jsonschema>=3.2.0,<4.9.0 diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index 701e1431..3d9b593b 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
-

Start Time: 2022-07-29 22:16:18

+

Start Time: 2022-09-24 21:26:53

-

Stop Time: 2022-07-30 04:12:54

+

Stop Time: 2022-09-25 03:49:07

-

Duration: 5h 1 min

+

Duration: 5h 27 min

@@ -465,11 +465,11 @@ - + TestEbookConvertCalibre 15 - 13 - 2 + 15 + 0 0 0 @@ -506,31 +506,11 @@ - +
TestEbookConvertCalibre - test_convert_failed_and_email
- -
- FAIL -
- - - - + PASS @@ -544,32 +524,11 @@ AssertionError: 1 != 0 - +
TestEbookConvertCalibre - test_convert_options
- -
- FAIL -
- - - - + PASS @@ -2153,11 +2112,11 @@ AssertionError: 0.0 not greater than or equal to 0.05 - + TestGoodreads 3 - 3 - 0 + 2 + 1 0 0 @@ -2167,11 +2126,31 @@ AssertionError: 0.0 not greater than or equal to 0.05 - +
TestGoodreads - test_author_page
- PASS + +
+ FAIL +
+ + + + @@ -3645,11 +3624,11 @@ AssertionError: 0.0 not greater than or equal to 0.05 - + TestThumbnails 8 - 7 - 0 + 2 + 5 0 1 @@ -3668,29 +3647,89 @@ AssertionError: 0.0 not greater than or equal to 0.05 - +
TestThumbnails - test_cache_of_deleted_book
- PASS + +
+ FAIL +
+ + + + - +
TestThumbnails - test_cover_cache_on_database_change
- PASS + +
+ FAIL +
+ + + + - +
TestThumbnails - test_cover_change_on_upload_new_cover
- PASS + +
+ FAIL +
+ + + + @@ -3704,11 +3743,31 @@ AssertionError: 0.0 not greater than or equal to 0.05 - +
TestThumbnails - test_cover_on_upload_book
- PASS + +
+ FAIL +
+ + + + @@ -3722,101 +3781,26 @@ AssertionError: 0.0 not greater than or equal to 0.05 - +
TestThumbnails - test_sideloaded_book
- PASS - - - - - - - TestUpdater - 9 - 8 - 0 - 0 - 1 - - Detail - - - - - - - -
TestUpdater - test_check_update_nightly_errors
- - PASS - - - - - - -
TestUpdater - test_check_update_nightly_request_errors
- - PASS - - - - - - -
TestUpdater - test_check_update_stable_errors
- - PASS - - - - - - -
TestUpdater - test_check_update_stable_versions
- - PASS - - - - - - -
TestUpdater - test_perform_update
- - PASS - - - - - - -
TestUpdater - test_perform_update_stable_errors
- - PASS - - - - - - -
TestUpdater - test_perform_update_timeout
-
- SKIP + FAIL
-