From cb09f8d4405d4a873cd9097924fe4da932cbfed4 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Mon, 7 Jun 2021 12:41:28 -0400 Subject: [PATCH] Fixed BetaSeries AttributeError exception #1423 --- libs/subliminal_patch/providers/betaseries.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libs/subliminal_patch/providers/betaseries.py b/libs/subliminal_patch/providers/betaseries.py index f4c769293..65530ed66 100644 --- a/libs/subliminal_patch/providers/betaseries.py +++ b/libs/subliminal_patch/providers/betaseries.py @@ -28,13 +28,14 @@ server_url = 'https://api.betaseries.com/' class BetaSeriesSubtitle(Subtitle): provider_name = 'betaseries' - def __init__(self, subtitle_id, language, video_name, url, matches, source): + def __init__(self, subtitle_id, language, video_name, url, matches, source, video_release_group): super(BetaSeriesSubtitle, self).__init__(language, page_link=url) self.subtitle_id = subtitle_id self.video_name = video_name self.download_url = url self.matches = matches self.source = source + self.video_release_group = video_release_group @property def id(self): @@ -67,6 +68,7 @@ class BetaSeriesProvider(Provider): if not token: raise ConfigurationError('Token must be specified') self.token = token + self.video = None def initialize(self): self.session = Session() @@ -129,7 +131,8 @@ class BetaSeriesProvider(Provider): # Filter seriessub source because it shut down so the links are all 404 if str(sub['source']) != 'seriessub': subtitles.append(BetaSeriesSubtitle( - sub['id'], language, sub['file'], sub['url'], matches, str(sub['source']))) + sub['id'], language, sub['file'], sub['url'], matches, str(sub['source']), + self.video.release_group)) return subtitles @@ -148,7 +151,7 @@ class BetaSeriesProvider(Provider): archive = _get_archive(r.content) if archive: subtitle_names = _get_subtitle_names_from_archive(archive) - subtitle_to_download = _choose_subtitle_with_release_group(subtitle_names, self.video.release_group) + subtitle_to_download = _choose_subtitle_with_release_group(subtitle_names, subtitle.video_release_group) logger.debug('Subtitle to download: ' + subtitle_to_download) subtitle_content = archive.read(subtitle_to_download) else: