no log: improved queries to os.com to prevent redirection

pull/2228/head
morpheus65535 1 year ago
parent 344543cc79
commit 403386c7d8

@ -287,11 +287,11 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider):
if not title_id: if not title_id:
return [] return []
# be sure to remove duplicates # be sure to remove duplicates using list(set())
lang_strings = list(set([to_opensubtitlescom(lang.basename) for lang in languages])) langs_list = sorted(list(set([to_opensubtitlescom(lang.basename).lower() for lang in languages])))
langs = ','.join(lang_strings) langs = ','.join(langs_list)
logging.debug(f'Searching for those languages: {lang_strings}') logging.debug(f'Searching for those languages: {langs}')
# query the server # query the server
if isinstance(self.video, Episode): if isinstance(self.video, Episode):
@ -301,8 +301,7 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider):
params=(('ai_translated', 'exclude'), params=(('ai_translated', 'exclude'),
('episode_number', self.video.episode), ('episode_number', self.video.episode),
('imdb_id', imdb_id if not title_id else None), ('imdb_id', imdb_id if not title_id else None),
('languages', langs.lower()), ('languages', langs),
('machine_translated', 'exclude'),
('moviehash', file_hash), ('moviehash', file_hash),
('parent_feature_id', title_id if title_id else None), ('parent_feature_id', title_id if title_id else None),
('season_number', self.video.season)), ('season_number', self.video.season)),
@ -319,8 +318,7 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider):
params=(('ai_translated', 'exclude'), params=(('ai_translated', 'exclude'),
('id', title_id if title_id else None), ('id', title_id if title_id else None),
('imdb_id', imdb_id if not title_id else None), ('imdb_id', imdb_id if not title_id else None),
('languages', langs.lower()), ('languages', langs),
('machine_translated', 'exclude'),
('moviehash', file_hash)), ('moviehash', file_hash)),
timeout=30), timeout=30),
validate_json=True, validate_json=True,

Loading…
Cancel
Save