Prevent errors in reporting to server
For other media that are not movies and tv shows.
This commit is contained in:
parent
88632dad60
commit
e24d982c36
1 changed files with 27 additions and 9 deletions
|
@ -195,14 +195,23 @@ 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.get('result', "").get('currentaudiostream', "").get('index', 0)
|
# Audio tracks
|
||||||
indexSubs = result.get('result', "").get('currentsubtitle', "").get('index', 0)
|
indexAudio = result.get('result', 0)
|
||||||
subsEnabled = result.get('result', "").get('subtitleenabled', "")
|
if indexAudio:
|
||||||
|
indexAudio = indexAudio.get('currentaudiostream', {}).get('index', 0)
|
||||||
|
# Subtitles tracks
|
||||||
|
indexSubs = result.get('result', 0)
|
||||||
|
if indexSubs:
|
||||||
|
indexSubs = indexSubs.get('currentsubtitle', {}).get('index', 0)
|
||||||
|
# If subtitles are enabled
|
||||||
|
subsEnabled = result.get('result', "")
|
||||||
|
if subsEnabled:
|
||||||
|
subsEnabled = subsEnabled.get('subtitleenabled', "")
|
||||||
|
|
||||||
# Convert back into an Emby index
|
# Convert back into an Emby index
|
||||||
audioTracks = len(xbmc.Player().getAvailableAudioStreams())
|
audioTracks = len(xbmc.Player().getAvailableAudioStreams())
|
||||||
indexAudio = indexAudio + 1
|
indexAudio = indexAudio + 1
|
||||||
if subsEnabled:
|
if subsEnabled and len(xbmc.Player().getAvailableSubtitleStreams()) > 0:
|
||||||
indexSubs = indexSubs + audioTracks + 1
|
indexSubs = indexSubs + audioTracks + 1
|
||||||
else:
|
else:
|
||||||
indexSubs = ""
|
indexSubs = ""
|
||||||
|
@ -316,12 +325,21 @@ 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.get('result', "").get('currentaudiostream', "").get('index', 0)
|
# Audio tracks
|
||||||
indexSubs = result.get('result', "").get('currentsubtitle', "").get('index', 0)
|
indexAudio = result.get('result', 0)
|
||||||
subsEnabled = result.get('result', "").get('subtitleenabled', "")
|
if indexAudio:
|
||||||
|
indexAudio = indexAudio.get('currentaudiostream', {}).get('index', 0)
|
||||||
postdata['AudioStreamIndex'] = indexAudio + 1
|
# Subtitles tracks
|
||||||
|
indexSubs = result.get('result', 0)
|
||||||
|
if indexSubs:
|
||||||
|
indexSubs = indexSubs.get('currentsubtitle', {}).get('index', 0)
|
||||||
|
# If subtitles are enabled
|
||||||
|
subsEnabled = result.get('result', "")
|
||||||
if subsEnabled:
|
if subsEnabled:
|
||||||
|
subsEnabled = subsEnabled.get('subtitleenabled', "")
|
||||||
|
# Postdata for the audio and subs tracks
|
||||||
|
postdata['AudioStreamIndex'] = indexAudio + 1
|
||||||
|
if subsEnabled and len(xbmc.Player().getAvailableSubtitleStreams()) > 0:
|
||||||
audioTracks = len(xbmc.Player().getAvailableAudioStreams())
|
audioTracks = len(xbmc.Player().getAvailableAudioStreams())
|
||||||
postdata['SubtitleStreamIndex'] = indexSubs + audioTracks + 1
|
postdata['SubtitleStreamIndex'] = indexSubs + audioTracks + 1
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue