Fix for refiner when the API doesn't have all the required information.

This commit is contained in:
Louis Vézina 2019-02-15 12:51:18 -05:00
parent 263b20ab76
commit 5e11f195eb
2 changed files with 18 additions and 12 deletions

View File

@ -84,11 +84,15 @@ def sync_episodes():
resolution = str(episode['episodeFile']['quality']['quality']['resolution']) + 'p'
if 'mediaInfo' in episode['episodeFile']:
videoCodec = episode['episodeFile']['mediaInfo']['videoCodec']
videoCodec = SonarrFormatVideoCodec(videoCodec)
if 'videoCodec' in episode['episodeFile']['mediaInfo']:
videoCodec = episode['episodeFile']['mediaInfo']['videoCodec']
videoCodec = SonarrFormatVideoCodec(videoCodec)
else: videoCodec = None
audioCodec = episode['episodeFile']['mediaInfo']['audioCodec']
audioCodec = SonarrFormatAudioCodec(audioCodec)
if 'audioCodec' in episode['episodeFile']['mediaInfo']:
audioCodec = episode['episodeFile']['mediaInfo']['audioCodec']
audioCodec = SonarrFormatAudioCodec(audioCodec)
else: audioCodec = None
else:
videoCodec = None
audioCodec = None

View File

@ -87,16 +87,18 @@ def update_movies():
resolution = movie['movieFile']['quality']['quality']['resolution'].lstrip('r').lower()
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']
videoFormat = videoCodecID = videoProfile = videoCodecLibrary = None
if 'videoFormat' in movie['movieFile']['mediaInfo']: videoFormat = movie['movieFile']['mediaInfo']['videoFormat']
if 'videoCodecID' in movie['movieFile']['mediaInfo']: videoCodecID = movie['movieFile']['mediaInfo']['videoCodecID']
if 'videoProfile' in movie['movieFile']['mediaInfo']: videoProfile = movie['movieFile']['mediaInfo']['videoProfile']
if 'videoCodecLibrary' in movie['movieFile']['mediaInfo']: 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']
audioFormat = audioCodec = audioProfile = audioAdditionalFeatures = None
if 'audioFormat' in movie['movieFile']['mediaInfo']: audioFormat = movie['movieFile']['mediaInfo']['audioFormat']
if 'audioCodecID' in movie['movieFile']['mediaInfo']: audioCodecID = movie['movieFile']['mediaInfo']['audioCodecID']
if 'audioProfile' in movie['movieFile']['mediaInfo']: audioProfile = movie['movieFile']['mediaInfo']['audioProfile']
if 'audioAdditionalFeatures' in movie['movieFile']['mediaInfo']: audioAdditionalFeatures = movie['movieFile']['mediaInfo']['audioAdditionalFeatures']
audioCodec = RadarrFormatAudioCodec(audioFormat, audioCodecID, audioProfile, audioAdditionalFeatures)
else:
videoCodec = None