diff options
author | morpheus65535 <[email protected]> | 2023-12-26 23:54:29 -0500 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2023-12-26 23:54:29 -0500 |
commit | 5739b9ad08b6c0c7eef14aad21863c8a08a88852 (patch) | |
tree | a2802dd9eae95269c1f6a4082cd0944ca772bd93 /libs | |
parent | 7c40bfec1e390552c6f54c93e7cc5336307ed237 (diff) | |
download | bazarr-5739b9ad08b6c0c7eef14aad21863c8a08a88852.tar.gz bazarr-5739b9ad08b6c0c7eef14aad21863c8a08a88852.zip |
Added opensubtitlescom settings to include AI translated subtitles in search results.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/subliminal_patch/providers/opensubtitlescom.py | 9 |
1 files changed, 6 insertions, 3 deletions
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), |