mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 18:26:15 +00:00
some items dont return any data for tracks
This commit is contained in:
parent
39ccf258fa
commit
b235046ea6
1 changed files with 19 additions and 14 deletions
|
@ -160,23 +160,28 @@ class Player(xbmc.Player):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = xbmc.executeJSONRPC(json.dumps(tracks_query))
|
result = xbmc.executeJSONRPC(json.dumps(tracks_query))
|
||||||
result = json.loads(result)
|
tracks_data = None
|
||||||
result = result.get('result')
|
try:
|
||||||
|
tracks_data = json.loads(result)
|
||||||
|
tracks_data = tracks_data.get('result')
|
||||||
|
except:
|
||||||
|
tracks_data = None
|
||||||
|
|
||||||
try: # Audio tracks
|
if tracks_data is not None:
|
||||||
indexAudio = result['currentaudiostream']['index']
|
try: # Audio tracks
|
||||||
except (KeyError, TypeError):
|
indexAudio = tracks_data['currentaudiostream']['index']
|
||||||
indexAudio = 0
|
except (KeyError, TypeError):
|
||||||
|
indexAudio = 0
|
||||||
|
|
||||||
try: # Subtitles tracks
|
try: # Subtitles tracks
|
||||||
indexSubs = result['currentsubtitle']['index']
|
indexSubs = tracks_data['currentsubtitle']['index']
|
||||||
except (KeyError, TypeError):
|
except (KeyError, TypeError):
|
||||||
indexSubs = 0
|
indexSubs = 0
|
||||||
|
|
||||||
try: # If subtitles are enabled
|
try: # If subtitles are enabled
|
||||||
subsEnabled = result['subtitleenabled']
|
subsEnabled = tracks_data['subtitleenabled']
|
||||||
except (KeyError, TypeError):
|
except (KeyError, TypeError):
|
||||||
subsEnabled = ""
|
subsEnabled = ""
|
||||||
|
|
||||||
# Postdata for the audio
|
# Postdata for the audio
|
||||||
postdata['AudioStreamIndex'] = indexAudio + 1
|
postdata['AudioStreamIndex'] = indexAudio + 1
|
||||||
|
|
Loading…
Reference in a new issue