diff options
-rw-r--r-- | bazarr/app/config.py | 1 | ||||
-rw-r--r-- | bazarr/app/get_providers.py | 1 | ||||
-rw-r--r-- | frontend/src/pages/Settings/Providers/list.ts | 5 | ||||
-rw-r--r-- | libs/subliminal_patch/providers/opensubtitlescom.py | 9 |
4 files changed, 13 insertions, 3 deletions
diff --git a/bazarr/app/config.py b/bazarr/app/config.py index 3bef51cb1..2f5ff9a7f 100644 --- a/bazarr/app/config.py +++ b/bazarr/app/config.py @@ -201,6 +201,7 @@ validators = [ Validator('opensubtitlescom.username', must_exist=True, default='', is_type_of=str, cast=str), Validator('opensubtitlescom.password', must_exist=True, default='', is_type_of=str, cast=str), Validator('opensubtitlescom.use_hash', must_exist=True, default=True, is_type_of=bool), + Validator('opensubtitlescom.include_ai_translated', must_exist=True, default=False, is_type_of=bool), # addic7ed section Validator('addic7ed.username', must_exist=True, default='', is_type_of=str, cast=str), diff --git a/bazarr/app/get_providers.py b/bazarr/app/get_providers.py index 28a8b1aeb..fea4b6094 100644 --- a/bazarr/app/get_providers.py +++ b/bazarr/app/get_providers.py @@ -240,6 +240,7 @@ def get_providers_auth(): 'opensubtitlescom': {'username': settings.opensubtitlescom.username, 'password': settings.opensubtitlescom.password, 'use_hash': settings.opensubtitlescom.use_hash, + 'include_ai_translated': settings.opensubtitlescom.include_ai_translated, 'api_key': 's38zmzVlW7IlYruWi7mHwDYl2SfMQoC1' }, 'podnapisi': { diff --git a/frontend/src/pages/Settings/Providers/list.ts b/frontend/src/pages/Settings/Providers/list.ts index 0f1375756..81ab6141a 100644 --- a/frontend/src/pages/Settings/Providers/list.ts +++ b/frontend/src/pages/Settings/Providers/list.ts @@ -286,6 +286,11 @@ export const ProviderList: Readonly<ProviderInfo[]> = [ key: "use_hash", name: "Use Hash", }, + { + type: "switch", + key: "include_ai_translated", + name: "Include AI translated subtitles in search results", + }, ], }, { diff --git a/libs/subliminal_patch/providers/opensubtitlescom.py b/libs/subliminal_patch/providers/opensubtitlescom.py index 8576dc2e0..615bc8cf1 100644 --- a/libs/subliminal_patch/providers/opensubtitlescom.py +++ b/libs/subliminal_patch/providers/opensubtitlescom.py @@ -162,7 +162,7 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider): video_types = (Episode, Movie) - def __init__(self, username=None, password=None, use_hash=True, api_key=None): + def __init__(self, username=None, password=None, use_hash=True, include_ai_translated=False, api_key=None): if not all((username, password)): raise ConfigurationError('Username and password must be specified') @@ -181,6 +181,7 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider): self.password = password self.video = None self.use_hash = use_hash + self.include_ai_translated = include_ai_translated self._started = None def initialize(self): @@ -300,7 +301,8 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider): res = self.retry( lambda: self.checked( lambda: self.session.get(self.server_url + 'subtitles', - params=(('ai_translated', 'exclude'), + params=(('ai_translated', 'exclude' if not self.include_ai_translated + else 'include'), ('episode_number', self.video.episode), ('imdb_id', imdb_id if not title_id else None), ('languages', langs), @@ -317,7 +319,8 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider): res = self.retry( lambda: self.checked( lambda: self.session.get(self.server_url + 'subtitles', - params=(('ai_translated', 'exclude'), + params=(('ai_translated', 'exclude' if not self.include_ai_translated + else 'include'), ('id', title_id if title_id else None), ('imdb_id', imdb_id if not title_id else None), ('languages', langs), |