From 2b9f920454ad9dce4237293ff0e1528abb14ba4b Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 25 Mar 2023 10:42:36 +0100 Subject: [PATCH] Metadata backup configurable --- cps/admin.py | 1 + cps/config_sql.py | 1 + cps/schedule.py | 4 ++-- cps/templates/admin.html | 7 ++++++- cps/templates/schedule_edit.html | 4 ++++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cps/admin.py b/cps/admin.py index 610afa17..b24c9508 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -1358,6 +1358,7 @@ def update_scheduledtasks(): error = True _config_checkbox(to_save, "schedule_generate_book_covers") _config_checkbox(to_save, "schedule_generate_series_covers") + _config_checkbox(to_save, "schedule_metadata_backup") _config_checkbox(to_save, "schedule_reconnect") if not error: diff --git a/cps/config_sql.py b/cps/config_sql.py index 771b353c..f4ac88fd 100644 --- a/cps/config_sql.py +++ b/cps/config_sql.py @@ -153,6 +153,7 @@ class _Settings(_Base): schedule_generate_book_covers = Column(Boolean, default=False) schedule_generate_series_covers = Column(Boolean, default=False) schedule_reconnect = Column(Boolean, default=False) + schedule_metadata_backup = Column(Boolean, default=False) config_password_policy = Column(Boolean, default=True) config_password_min_length = Column(Integer, default=8) diff --git a/cps/schedule.py b/cps/schedule.py index cab8d7d3..05367e99 100644 --- a/cps/schedule.py +++ b/cps/schedule.py @@ -31,8 +31,8 @@ def get_scheduled_tasks(reconnect=True): if reconnect: tasks.append([lambda: TaskReconnectDatabase(), 'reconnect', False]) - # ToDo make configurable. Generate metadata.opf file for each changed book - if True: + # Generate metadata.opf file for each changed book + if config.schedule_metadata_backup: tasks.append([lambda: TaskBackupMetadata("en"), 'backup metadata', False]) # Generate all missing book cover thumbnails diff --git a/cps/templates/admin.html b/cps/templates/admin.html index 9460fa83..ac124fe8 100644 --- a/cps/templates/admin.html +++ b/cps/templates/admin.html @@ -186,6 +186,10 @@
{{_('Reconnect Calibre Database')}}
{{ display_bool_setting(config.schedule_reconnect) }}
+
+
{{_('Generate Metadata Backup Files')}}
+
{{ display_bool_setting(config.schedule_metadata_backup) }}
+
{{_('Edit Scheduled Tasks Settings')}} @@ -207,10 +211,11 @@
{{_('Restart')}}
{{_('Shutdown')}}
+{% if config.schedule_metadata_backup %}
{{_('Queue all books for metadata backup')}}
- +{% endif %}

{{_('Version Information')}}

diff --git a/cps/templates/schedule_edit.html b/cps/templates/schedule_edit.html index 7b6d8e33..75d0660d 100644 --- a/cps/templates/schedule_edit.html +++ b/cps/templates/schedule_edit.html @@ -36,6 +36,10 @@
+
+ + +
{{_('Cancel')}}