Fix error for playback report

Take into account TypeError (nonetype), depending on the player used, it
might not return a result.
This commit is contained in:
angelblue05 2015-10-19 00:40:19 -05:00
parent 6849c22414
commit a0347ce03d

View file

@ -134,17 +134,17 @@ class Player( xbmc.Player ):
try: # Audio tracks try: # Audio tracks
indexAudio = result['currentaudiostream']['index'] indexAudio = result['currentaudiostream']['index']
except KeyError: except (KeyError, TypeError):
indexAudio = 0 indexAudio = 0
try: # Subtitles tracks try: # Subtitles tracks
indexSubs = result['currentsubtitle']['index'] indexSubs = result['currentsubtitle']['index']
except KeyError: except (KeyError, TypeError):
indexSubs = 0 indexSubs = 0
try: # If subtitles are enabled try: # If subtitles are enabled
subsEnabled = result['subtitleenabled'] subsEnabled = result['subtitleenabled']
except KeyError: except (KeyError, TypeError):
subsEnabled = "" subsEnabled = ""
# Postdata for the audio # Postdata for the audio
@ -276,17 +276,17 @@ class Player( xbmc.Player ):
try: # Audio tracks try: # Audio tracks
indexAudio = result['currentaudiostream']['index'] indexAudio = result['currentaudiostream']['index']
except KeyError: except (KeyError, TypeError):
indexAudio = 0 indexAudio = 0
try: # Subtitles tracks try: # Subtitles tracks
indexSubs = result['currentsubtitle']['index'] indexSubs = result['currentsubtitle']['index']
except KeyError: except (KeyError, TypeError):
indexSubs = 0 indexSubs = 0
try: # If subtitles are enabled try: # If subtitles are enabled
subsEnabled = result['subtitleenabled'] subsEnabled = result['subtitleenabled']
except KeyError: except (KeyError, TypeError):
subsEnabled = "" subsEnabled = ""
# Postdata for the audio # Postdata for the audio