mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +00:00
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}'
|
||||
result = xbmc.executeJSONRPC(track_query)
|
||||
result = json.loads(result)
|
||||
indexAudio = result.get('result', "").get('currentaudiostream', "").get('index', 0)
|
||||
indexSubs = result.get('result', "").get('currentsubtitle', "").get('index', 0)
|
||||
subsEnabled = result.get('result', "").get('subtitleenabled', "")
|
||||
# Audio tracks
|
||||
indexAudio = result.get('result', 0)
|
||||
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
|
||||
audioTracks = len(xbmc.Player().getAvailableAudioStreams())
|
||||
indexAudio = indexAudio + 1
|
||||
if subsEnabled:
|
||||
if subsEnabled and len(xbmc.Player().getAvailableSubtitleStreams()) > 0:
|
||||
indexSubs = indexSubs + audioTracks + 1
|
||||
else:
|
||||
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}'
|
||||
result = xbmc.executeJSONRPC(track_query)
|
||||
result = json.loads(result)
|
||||
indexAudio = result.get('result', "").get('currentaudiostream', "").get('index', 0)
|
||||
indexSubs = result.get('result', "").get('currentsubtitle', "").get('index', 0)
|
||||
subsEnabled = result.get('result', "").get('subtitleenabled', "")
|
||||
|
||||
postdata['AudioStreamIndex'] = indexAudio + 1
|
||||
# Audio tracks
|
||||
indexAudio = result.get('result', 0)
|
||||
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', "")
|
||||
# Postdata for the audio and subs tracks
|
||||
postdata['AudioStreamIndex'] = indexAudio + 1
|
||||
if subsEnabled and len(xbmc.Player().getAvailableSubtitleStreams()) > 0:
|
||||
audioTracks = len(xbmc.Player().getAvailableAudioStreams())
|
||||
postdata['SubtitleStreamIndex'] = indexSubs + audioTracks + 1
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue