diff options
author | morpheus65535 <[email protected]> | 2022-08-17 16:46:12 -0400 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2022-08-17 16:46:12 -0400 |
commit | 0fb928675c2f020ecf34faecb12603a4e669eaae (patch) | |
tree | c35f9dfb294e748327e76ab3183500499c2b6f0f | |
parent | fca1c9656eaee17393849aa2b115d26e7e6a859a (diff) | |
download | bazarr-0fb928675c2f020ecf34faecb12603a4e669eaae.tar.gz bazarr-0fb928675c2f020ecf34faecb12603a4e669eaae.zip |
Fixed compatibility with the latest nightly version of Sonarr v4.v1.1.1-beta.15
-rw-r--r-- | bazarr/sonarr/sync/parser.py | 11 | ||||
-rw-r--r-- | bazarr/sonarr/sync/utils.py | 4 |
2 files changed, 14 insertions, 1 deletions
diff --git a/bazarr/sonarr/sync/parser.py b/bazarr/sonarr/sync/parser.py index 47ca9f4ff..6c8613d8f 100644 --- a/bazarr/sonarr/sync/parser.py +++ b/bazarr/sonarr/sync/parser.py @@ -29,7 +29,10 @@ def seriesParser(show, action, tags_dict, serie_default_profile, audio_profiles) if get_sonarr_info.is_legacy(): audio_language = profile_id_to_language(show['qualityProfileId'], audio_profiles) else: - audio_language = profile_id_to_language(show['languageProfileId'], audio_profiles) + if 'languageProfileId' in show: + audio_language = profile_id_to_language(show['languageProfileId'], audio_profiles) + else: + audio_language = [] tags = [d['label'] for d in tags_dict if d['id'] in show['tags']] @@ -96,6 +99,12 @@ def episodeParser(episode): if isinstance(item, dict): if 'name' in item: audio_language.append(item['name']) + elif 'languages' in episode['episodeFile'] and len(episode['episodeFile']['languages']): + items = episode['episodeFile']['languages'] + if isinstance(items, list): + for item in items: + if 'name' in item: + audio_language.append(item['name']) else: audio_language = TableShows.get(TableShows.sonarrSeriesId == episode['seriesId']).audio_language diff --git a/bazarr/sonarr/sync/utils.py b/bazarr/sonarr/sync/utils.py index 3c3d8282d..d1eb4495f 100644 --- a/bazarr/sonarr/sync/utils.py +++ b/bazarr/sonarr/sync/utils.py @@ -30,6 +30,10 @@ def get_profile_list(): logging.exception("BAZARR Error trying to get profiles from Sonarr.") return None + # return an empty list when using Sonarr v4 that do not support series languages profiles anymore + if profiles_json.status_code == 404: + return profiles_list + # Parsing data returned from Sonarr if get_sonarr_info.is_legacy(): for profile in profiles_json.json(): |