diff --git a/tubearchivist/home/config.json b/tubearchivist/home/config.json index 8c4249a..1b6000e 100644 --- a/tubearchivist/home/config.json +++ b/tubearchivist/home/config.json @@ -25,6 +25,7 @@ "add_thumbnail": false, "subtitle": false, "subtitle_source": false, + "subtitle_index": false, "throttledratelimit": false, "integrate_ryd": false }, diff --git a/tubearchivist/home/src/frontend/forms.py b/tubearchivist/home/src/frontend/forms.py index 77648cf..8b7e188 100644 --- a/tubearchivist/home/src/frontend/forms.py +++ b/tubearchivist/home/src/frontend/forms.py @@ -74,6 +74,12 @@ class ApplicationSettingsForm(forms.Form): ("user", "only download uploader"), ] + SUBTITLE_INDEX_CHOICES = [ + ("", "-- change subtitle index settings --"), + ("0", "disable subtitle index"), + ("1", "enable subtitle index"), + ] + subscriptions_channel_size = forms.IntegerField(required=False) downloads_limit_count = forms.IntegerField(required=False) downloads_limit_speed = forms.IntegerField(required=False) @@ -91,6 +97,9 @@ class ApplicationSettingsForm(forms.Form): downloads_subtitle_source = forms.ChoiceField( widget=forms.Select, choices=SUBTITLE_SOURCE_CHOICES, required=False ) + downloads_subtitle_index = forms.ChoiceField( + widget=forms.Select, choices=SUBTITLE_INDEX_CHOICES, required=False + ) downloads_integrate_ryd = forms.ChoiceField( widget=forms.Select, choices=RYD_CHOICES, required=False ) diff --git a/tubearchivist/home/src/index/video.py b/tubearchivist/home/src/index/video.py index c4d48fb..d74b660 100644 --- a/tubearchivist/home/src/index/video.py +++ b/tubearchivist/home/src/index/video.py @@ -121,8 +121,9 @@ class YoutubeSubtitle: parser.process() subtitle_str = parser.get_subtitle_str() self._write_subtitle_file(dest_path, subtitle_str) - query_str = parser.create_bulk_import(self.video, source) - self._index_subtitle(query_str) + if self.video.config["downloads"]["subtitle_index"]: + query_str = parser.create_bulk_import(self.video, source) + self._index_subtitle(query_str) @staticmethod def _write_subtitle_file(dest_path, subtitle_str): diff --git a/tubearchivist/home/templates/home/settings.html b/tubearchivist/home/templates/home/settings.html index 3b9ffe9..7f41dd2 100644 --- a/tubearchivist/home/templates/home/settings.html +++ b/tubearchivist/home/templates/home/settings.html @@ -94,6 +94,9 @@ Embed thumbnail into the mediafile.
{{ app_form.downloads_add_thumbnail }} + +
+

Subtitles

Subtitles download setting: {{ config.downloads.subtitle }}
Choose which subtitles to download, add comma separated two letter language ISO code,
@@ -105,6 +108,11 @@ Download only user generated, or also less accurate auto generated subtitles.
{{ app_form.downloads_subtitle_source }}

+
+

Index and make subtitles searchable: {{ config.downloads.subtitle_index }}

+ Store subtitle lines in Elasticsearch. Not recommended for low-end hardware.
+ {{ app_form.downloads_subtitle_index }} +

Integrations