mirror of https://github.com/morpheus65535/bazarr
Merge pull request #986 from ngosang/feature/argent
argenteam provider: fix null exception and improve scoring
This commit is contained in:
commit
3b0eec371e
|
@ -76,9 +76,11 @@ class ArgenteamSubtitle(Subtitle):
|
||||||
if video.series and (sanitize(self.title) in (
|
if video.series and (sanitize(self.title) in (
|
||||||
sanitize(name) for name in [video.series] + video.alternative_series)):
|
sanitize(name) for name in [video.series] + video.alternative_series)):
|
||||||
matches.add('series')
|
matches.add('series')
|
||||||
|
|
||||||
# season
|
# season
|
||||||
if video.season and self.season == video.season:
|
if video.season and self.season == video.season:
|
||||||
matches.add('season')
|
matches.add('season')
|
||||||
|
|
||||||
# episode
|
# episode
|
||||||
if video.episode and self.episode == video.episode:
|
if video.episode and self.episode == video.episode:
|
||||||
matches.add('episode')
|
matches.add('episode')
|
||||||
|
@ -87,6 +89,9 @@ class ArgenteamSubtitle(Subtitle):
|
||||||
if video.tvdb_id and str(self.tvdb_id) == str(video.tvdb_id):
|
if video.tvdb_id and str(self.tvdb_id) == str(video.tvdb_id):
|
||||||
matches.add('tvdb_id')
|
matches.add('tvdb_id')
|
||||||
|
|
||||||
|
# year (year is not available for series, but we assume it matches)
|
||||||
|
matches.add('year')
|
||||||
|
|
||||||
elif isinstance(video, Movie) and self.movie_kind == 'movie':
|
elif isinstance(video, Movie) and self.movie_kind == 'movie':
|
||||||
# title
|
# title
|
||||||
if video.title and (sanitize(self.title) in (
|
if video.title and (sanitize(self.title) in (
|
||||||
|
@ -230,10 +235,10 @@ class ArgenteamProvider(Provider, ProviderSubtitleArchiveMixin):
|
||||||
has_multiple_ids = len(argenteam_ids) > 1
|
has_multiple_ids = len(argenteam_ids) > 1
|
||||||
for aid in argenteam_ids:
|
for aid in argenteam_ids:
|
||||||
response = self.session.get(url, params={'id': aid}, timeout=10)
|
response = self.session.get(url, params={'id': aid}, timeout=10)
|
||||||
|
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
content = response.json()
|
content = response.json()
|
||||||
|
|
||||||
|
if content is not None: # eg https://argenteam.net/api/v1/episode?id=11534
|
||||||
imdb_id = year = None
|
imdb_id = year = None
|
||||||
returned_title = title
|
returned_title = title
|
||||||
if not is_episode and "info" in content:
|
if not is_episode and "info" in content:
|
||||||
|
|
Loading…
Reference in New Issue