diff --git a/tubearchivist/home/config.json b/tubearchivist/home/config.json index 95c12118..a953a497 100644 --- a/tubearchivist/home/config.json +++ b/tubearchivist/home/config.json @@ -37,7 +37,8 @@ "cache_dir": "/cache", "videos": "/youtube", "colors": "dark", - "enable_cast": false + "enable_cast": false, + "enable_snapshot": false }, "scheduler": { "update_subscribed": false, diff --git a/tubearchivist/home/src/es/snapshot.py b/tubearchivist/home/src/es/snapshot.py index c2152198..239fa1ec 100644 --- a/tubearchivist/home/src/es/snapshot.py +++ b/tubearchivist/home/src/es/snapshot.py @@ -34,6 +34,7 @@ class ElasticSnapshot: def setup(self): """setup the snapshot in ES, create or update if needed""" + print("snapshot: run setup") repo_exists = self._check_repo_exists() if not repo_exists: self.create_repo() diff --git a/tubearchivist/home/src/frontend/forms.py b/tubearchivist/home/src/frontend/forms.py index 4459f9b5..90927c4b 100644 --- a/tubearchivist/home/src/frontend/forms.py +++ b/tubearchivist/home/src/frontend/forms.py @@ -74,6 +74,12 @@ class ApplicationSettingsForm(forms.Form): ("1", "enable Cast"), ] + SNAPSHOT_CHOICES = [ + ("", "-- change snapshot settings --"), + ("0", "disable system snapshots"), + ("1", "enable system snapshots"), + ] + SUBTITLE_SOURCE_CHOICES = [ ("", "-- change subtitle source settings"), ("user", "only download user created"), @@ -124,6 +130,9 @@ class ApplicationSettingsForm(forms.Form): application_enable_cast = forms.ChoiceField( widget=forms.Select, choices=CAST_CHOICES, required=False ) + application_enable_snapshot = forms.ChoiceField( + widget=forms.Select, choices=SNAPSHOT_CHOICES, required=False + ) class SchedulerSettingsForm(forms.Form): diff --git a/tubearchivist/home/templates/home/settings.html b/tubearchivist/home/templates/home/settings.html index 6477013d..30b656b9 100644 --- a/tubearchivist/home/templates/home/settings.html +++ b/tubearchivist/home/templates/home/settings.html @@ -153,6 +153,23 @@ {{ app_form.application_enable_cast }} +
Current system snapshot: {{ config.application.enable_snapshot }}
+ Automatically create daily deduplicated snapshots of the index, stored in Elasticsearch. Read first before activating: Wiki.Create next snapshot: {{ snapshots.next_exec_str }}, snapshots expire after {{ snapshots.expire_after }}
+Snapshot created on: {{ snapshot.start_date }}, took {{ snapshot.duration_s }}s to create
+ {% endfor %} + {% endif %} +