From 4d9e7b0cd14334c877f271425e49ad6ceff50de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Wed, 13 Feb 2019 08:58:18 -0500 Subject: [PATCH] Fix for refiner when mediaInfo isn'T available from API because Sonarr and Radarr do not analyse video file. --- bazarr/get_episodes.py | 12 ++++++++---- bazarr/get_movies.py | 24 ++++++++++++++---------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/bazarr/get_episodes.py b/bazarr/get_episodes.py index 4f80a2953..aceb74307 100644 --- a/bazarr/get_episodes.py +++ b/bazarr/get_episodes.py @@ -83,11 +83,15 @@ def sync_episodes(): format = episode['episodeFile']['quality']['quality']['name'] resolution = str(episode['episodeFile']['quality']['quality']['resolution']) + 'p' - videoCodec = episode['episodeFile']['mediaInfo']['videoCodec'] - videoCodec = SonarrFormatVideoCodec(videoCodec) + if 'mediaInfo' in episode['episodeFile']: + videoCodec = episode['episodeFile']['mediaInfo']['videoCodec'] + videoCodec = SonarrFormatVideoCodec(videoCodec) - audioCodec = episode['episodeFile']['mediaInfo']['audioCodec'] - audioCodec = SonarrFormatAudioCodec(audioCodec) + audioCodec = episode['episodeFile']['mediaInfo']['audioCodec'] + audioCodec = SonarrFormatAudioCodec(audioCodec) + else: + videoCodec = None + audioCodec = None # Add episodes in sonarr to current episode list current_episodes_sonarr.append(episode['id']) diff --git a/bazarr/get_movies.py b/bazarr/get_movies.py index 695322758..3403b749b 100644 --- a/bazarr/get_movies.py +++ b/bazarr/get_movies.py @@ -86,17 +86,21 @@ def update_movies(): format = movie['movieFile']['quality']['quality']['name'] resolution = movie['movieFile']['quality']['quality']['resolution'].lstrip('r').lower() - videoFormat = movie['movieFile']['mediaInfo']['videoFormat'] - videoCodecID = movie['movieFile']['mediaInfo']['videoCodecID'] - videoProfile = movie['movieFile']['mediaInfo']['videoProfile'] - videoCodecLibrary = movie['movieFile']['mediaInfo']['videoCodecLibrary'] - videoCodec = RadarrFormatVideoCodec(videoFormat, videoCodecID, videoProfile, videoCodecLibrary) + if 'mediaInfo' in movie['movieFile']: + videoFormat = movie['movieFile']['mediaInfo']['videoFormat'] + videoCodecID = movie['movieFile']['mediaInfo']['videoCodecID'] + videoProfile = movie['movieFile']['mediaInfo']['videoProfile'] + videoCodecLibrary = movie['movieFile']['mediaInfo']['videoCodecLibrary'] + videoCodec = RadarrFormatVideoCodec(videoFormat, videoCodecID, videoProfile, videoCodecLibrary) - audioFormat = movie['movieFile']['mediaInfo']['audioFormat'] - audioCodecID = movie['movieFile']['mediaInfo']['audioCodecID'] - audioProfile = movie['movieFile']['mediaInfo']['audioProfile'] - audioAdditionalFeatures = movie['movieFile']['mediaInfo']['audioAdditionalFeatures'] - audioCodec = RadarrFormatAudioCodec(audioFormat, audioCodecID, audioProfile, audioAdditionalFeatures) + audioFormat = movie['movieFile']['mediaInfo']['audioFormat'] + audioCodecID = movie['movieFile']['mediaInfo']['audioCodecID'] + audioProfile = movie['movieFile']['mediaInfo']['audioProfile'] + audioAdditionalFeatures = movie['movieFile']['mediaInfo']['audioAdditionalFeatures'] + audioCodec = RadarrFormatAudioCodec(audioFormat, audioCodecID, audioProfile, audioAdditionalFeatures) + else: + videoCodec = None + audioCodec = None # Add movies in radarr to current movies list current_movies_radarr.append(unicode(movie['tmdbId']))