1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-26 01:27:07 +00:00

Fixed BetaSeries AttributeError exception #1423

This commit is contained in:
morpheus65535 2021-06-07 12:41:28 -04:00
parent ea63ecfc2b
commit cb09f8d440

View file

@ -28,13 +28,14 @@ server_url = 'https://api.betaseries.com/'
class BetaSeriesSubtitle(Subtitle): class BetaSeriesSubtitle(Subtitle):
provider_name = 'betaseries' 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) super(BetaSeriesSubtitle, self).__init__(language, page_link=url)
self.subtitle_id = subtitle_id self.subtitle_id = subtitle_id
self.video_name = video_name self.video_name = video_name
self.download_url = url self.download_url = url
self.matches = matches self.matches = matches
self.source = source self.source = source
self.video_release_group = video_release_group
@property @property
def id(self): def id(self):
@ -67,6 +68,7 @@ class BetaSeriesProvider(Provider):
if not token: if not token:
raise ConfigurationError('Token must be specified') raise ConfigurationError('Token must be specified')
self.token = token self.token = token
self.video = None
def initialize(self): def initialize(self):
self.session = Session() self.session = Session()
@ -129,7 +131,8 @@ class BetaSeriesProvider(Provider):
# Filter seriessub source because it shut down so the links are all 404 # Filter seriessub source because it shut down so the links are all 404
if str(sub['source']) != 'seriessub': if str(sub['source']) != 'seriessub':
subtitles.append(BetaSeriesSubtitle( 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 return subtitles
@ -148,7 +151,7 @@ class BetaSeriesProvider(Provider):
archive = _get_archive(r.content) archive = _get_archive(r.content)
if archive: if archive:
subtitle_names = _get_subtitle_names_from_archive(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) logger.debug('Subtitle to download: ' + subtitle_to_download)
subtitle_content = archive.read(subtitle_to_download) subtitle_content = archive.read(subtitle_to_download)
else: else: