Fix playback key error

For real this time.
This commit is contained in:
angelblue05 2015-08-07 22:29:27 -05:00
parent cde8d965ff
commit ec6daa3a87

View file

@ -198,9 +198,9 @@ class Player( xbmc.Player ):
track_query = '{"jsonrpc": "2.0", "method": "Player.GetProperties", "params": {"playerid":1,"properties": ["currentsubtitle","currentaudiostream","subtitleenabled"]} , "id": 1}' track_query = '{"jsonrpc": "2.0", "method": "Player.GetProperties", "params": {"playerid":1,"properties": ["currentsubtitle","currentaudiostream","subtitleenabled"]} , "id": 1}'
result = xbmc.executeJSONRPC(track_query) result = xbmc.executeJSONRPC(track_query)
result = json.loads(result) result = json.loads(result)
indexAudio = result['result']['currentaudiostream'].get('index', "") indexAudio = result.get('result', "").get('currentaudiostream', "").get('index', 0)
indexSubs = result['result']['currentsubtitle'].get('index', "") indexSubs = result.get('result', "").get('currentsubtitle', "").get('index', 0)
subsEnabled = result['result']['subtitleenabled'] subsEnabled = result.get('result', "").get('subtitleenabled', "")
# Convert back into an Emby index # Convert back into an Emby index
audioTracks = len(xbmc.Player().getAvailableAudioStreams()) audioTracks = len(xbmc.Player().getAvailableAudioStreams())
@ -320,9 +320,9 @@ class Player( xbmc.Player ):
track_query = '{"jsonrpc": "2.0", "method": "Player.GetProperties", "params": {"playerid": 1,"properties": ["currentsubtitle","currentaudiostream","subtitleenabled"]} , "id": 1}' track_query = '{"jsonrpc": "2.0", "method": "Player.GetProperties", "params": {"playerid": 1,"properties": ["currentsubtitle","currentaudiostream","subtitleenabled"]} , "id": 1}'
result = xbmc.executeJSONRPC(track_query) result = xbmc.executeJSONRPC(track_query)
result = json.loads(result) result = json.loads(result)
indexAudio = result['result']['currentaudiostream'].get('index', "") indexAudio = result.get('result', "").get('currentaudiostream', "").get('index', 0)
indexSubs = result['result']['currentsubtitle'].get('index', "") indexSubs = result.get('result', "").get('currentsubtitle', "").get('index', 0)
subsEnabled = result['result']['subtitleenabled'] subsEnabled = result.get('result', "").get('subtitleenabled', "")
postdata['AudioStreamIndex'] = indexAudio + 1 postdata['AudioStreamIndex'] = indexAudio + 1
if subsEnabled: if subsEnabled: