Skip to content

Commit

Permalink
Fixed series indexing when malformed alternate title is returned by S…
Browse files Browse the repository at this point in the history
…onarr
  • Loading branch information
morpheus65535 committed Sep 8, 2024
1 parent f6c5ee6 commit 6ddfdfe
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bazarr/sonarr/sync/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ def seriesParser(show, action, tags_dict, language_profiles, serie_default_profi
if image['coverType'] == 'fanart':
fanart = image['url'].split('?')[0]

alternate_titles = None
if show['alternateTitles'] is not None:
alternate_titles = str([item['title'] for item in show['alternateTitles']])
alternate_titles = [item['title'] for item in show['alternateTitles'] if 'title' in item and item['title'] not
in [None, ''] and item["title"] != show["title"]]
else:
alternate_titles = []

tags = [d['label'] for d in tags_dict if d['id'] in show['tags']]

Expand All @@ -64,7 +66,7 @@ def seriesParser(show, action, tags_dict, language_profiles, serie_default_profi
'audio_language': str(audio_language),
'sortTitle': show['sortTitle'],
'year': str(show['year']),
'alternativeTitles': alternate_titles,
'alternativeTitles': str(alternate_titles),
'tags': str(tags),
'seriesType': show['seriesType'],
'imdbId': imdbId,
Expand Down

0 comments on commit 6ddfdfe

Please sign in to comment.