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

pull/310/head
Louis Vézina 6 years ago
parent 263b20ab76
commit 5e11f195eb

@ -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)
audioCodec = episode['episodeFile']['mediaInfo']['audioCodec']
audioCodec = SonarrFormatAudioCodec(audioCodec)
if 'videoCodec' in episode['episodeFile']['mediaInfo']:
videoCodec = episode['episodeFile']['mediaInfo']['videoCodec']
videoCodec = SonarrFormatVideoCodec(videoCodec)
else: videoCodec = None
if 'audioCodec' in episode['episodeFile']['mediaInfo']:
audioCodec = episode['episodeFile']['mediaInfo']['audioCodec']
audioCodec = SonarrFormatAudioCodec(audioCodec)
else: audioCodec = None
else:
videoCodec = None
audioCodec = None

@ -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

Loading…
Cancel
Save