diff options
author | morpheus65535 <[email protected]> | 2022-01-16 09:56:34 -0500 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2022-01-16 09:56:34 -0500 |
commit | 75d73cf6049a86e496839c775c9f4c128b1320cf (patch) | |
tree | ad6687ad8abb981992f5fcd63c43eb25d493cd73 | |
parent | 92c3dc9f002e2c78787416861acce6d3d4b528f2 (diff) | |
download | bazarr-75d73cf6049a86e496839c775c9f4c128b1320cf.tar.gz bazarr-75d73cf6049a86e496839c775c9f4c128b1320cf.zip |
Fixed Subscene provider for US shows. #1678
-rw-r--r-- | libs/subliminal_patch/providers/subscene.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libs/subliminal_patch/providers/subscene.py b/libs/subliminal_patch/providers/subscene.py index 66329a779..e11ab0b02 100644 --- a/libs/subliminal_patch/providers/subscene.py +++ b/libs/subliminal_patch/providers/subscene.py @@ -245,7 +245,17 @@ class SubsceneProvider(Provider, ProviderSubtitleArchiveMixin): self._create_filters(languages) self._enable_filters() - return [s for s in self.query(video) if s.language in languages] + + if isinstance(video, Episode): + international_titles = list(set([video.series] + video.alternative_series[:1])) + subtitles = [s for s in self.query(video, international_titles) if s.language in languages] + if not len(subtitles): + us_titles = [x + ' (US)' for x in international_titles] + subtitles = [s for s in self.query(video, us_titles) if s.language in languages] + return subtitles + else: + titles = list(set([video.title] + video.alternative_titles[:1])) + return [s for s in self.query(video, titles) if s.language in languages] def download_subtitle(self, subtitle): if subtitle.pack_data: @@ -319,10 +329,9 @@ class SubsceneProvider(Provider, ProviderSubtitleArchiveMixin): raise @reinitialize_on_error((RequestException,), attempts=1) - def query(self, video): + def query(self, video, titles): subtitles = [] if isinstance(video, Episode): - titles = list(set([video.series] + video.alternative_series[:1])) more_than_one = len(titles) > 1 for series in titles: term = u"%s - %s Season" % (series, p.number_to_words("%sth" % video.season).capitalize()) @@ -343,7 +352,6 @@ class SubsceneProvider(Provider, ProviderSubtitleArchiveMixin): if more_than_one: time.sleep(self.search_throttle) else: - titles = list(set([video.title] + video.alternative_titles[:1])) more_than_one = len(titles) > 1 for title in titles: logger.debug('Searching for movie results: %r', title) |