mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 12:16:12 +00:00
Quick follow up
Account for when subtitles are disabled.
This commit is contained in:
parent
abe60aa3b8
commit
567da0114e
1 changed files with 13 additions and 5 deletions
|
@ -177,16 +177,20 @@ class Player( xbmc.Player ):
|
||||||
muted = result.get(u'result').get(u'muted')
|
muted = result.get(u'result').get(u'muted')
|
||||||
|
|
||||||
# Get current audio and subtitles track
|
# Get current audio and subtitles track
|
||||||
track_query = '{"jsonrpc": "2.0", "method": "Player.GetProperties", "params": {"playerid":1,"properties": ["currentsubtitle","currentaudiostream"]} , "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']['index']
|
indexAudio = result['result']['currentaudiostream']['index']
|
||||||
indexSubs = result['result']['currentsubtitle']['index']
|
indexSubs = result['result']['currentsubtitle']['index']
|
||||||
|
boolSubs = result['result']['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
|
||||||
indexSubs = indexSubs + audioTracks + 1
|
if boolSubs:
|
||||||
|
indexSubs = indexSubs + audioTracks + 1
|
||||||
|
else:
|
||||||
|
indexSubs = ""
|
||||||
|
|
||||||
postdata = {
|
postdata = {
|
||||||
'QueueableMediaTypes': "Video",
|
'QueueableMediaTypes': "Video",
|
||||||
|
@ -286,11 +290,12 @@ class Player( xbmc.Player ):
|
||||||
muted = result.get(u'result').get(u'muted')
|
muted = result.get(u'result').get(u'muted')
|
||||||
|
|
||||||
# Get the current audio track and subtitles
|
# Get the current audio track and subtitles
|
||||||
track_query = '{"jsonrpc": "2.0", "method": "Player.GetProperties", "params": {"playerid":1,"properties": ["currentsubtitle","currentaudiostream"]} , "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']['index']
|
indexAudio = result['result']['currentaudiostream']['index']
|
||||||
indexSubs = result['result']['currentsubtitle']['index']
|
indexSubs = result['result']['currentsubtitle']['index']
|
||||||
|
boolSubs = result['result']['subtitleenabled']
|
||||||
|
|
||||||
seekTime = xbmc.Player().getTime()
|
seekTime = xbmc.Player().getTime()
|
||||||
|
|
||||||
|
@ -314,8 +319,11 @@ class Player( xbmc.Player ):
|
||||||
if subtitleindex:
|
if subtitleindex:
|
||||||
postdata['SubtitleStreamIndex'] = subtitleindex
|
postdata['SubtitleStreamIndex'] = subtitleindex
|
||||||
else:
|
else:
|
||||||
audioTracks = len(xbmc.Player().getAvailableAudioStreams())
|
if boolSubs:
|
||||||
postdata['SubtitleStreamIndex'] = indexSubs + audioTracks + 1
|
audioTracks = len(xbmc.Player().getAvailableAudioStreams())
|
||||||
|
postdata['SubtitleStreamIndex'] = indexSubs + audioTracks + 1
|
||||||
|
else:
|
||||||
|
postdata['SubtitleStreamIndex'] = ""
|
||||||
|
|
||||||
# Post playback to server
|
# Post playback to server
|
||||||
self.logMsg("Sending POST play started.", 1)
|
self.logMsg("Sending POST play started.", 1)
|
||||||
|
|
Loading…
Reference in a new issue