Skip to content

Commit

Permalink
Fix issue when Player() subclassed
Browse files Browse the repository at this point in the history
adding Player.GetActivePlayers for guering real active Playeyer
  • Loading branch information
zbyna authored and ace20022 committed Oct 5, 2016
1 parent 78cc587 commit 575f2a0
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions default.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,19 @@ def evalCondSubPrefs(self, condsub_prefs):
return -2

def getDetails(self):
details_query_string = '{"jsonrpc": "2.0", "method": "Player.GetProperties", "params":' \
'{ "properties": ["currentaudiostream", "audiostreams", "subtitleenabled", "currentsubtitle", "subtitles" ], "playerid": 1 },' \
'"id": 1}'
activePlayers ='{"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}'
json_query = xbmc.executeJSONRPC(activePlayers)
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = simplejson.loads(json_query)
activePlayerID = json_response['result'][0]['playerid']
details_query_dict = { "jsonrpc": "2.0",
"method": "Player.GetProperties",
"params": { "properties":
["currentaudiostream", "audiostreams", "subtitleenabled",
"currentsubtitle", "subtitles" ],
"playerid": activePlayerID },
"id": 1}
details_query_string = simplejson.dumps(details_query_dict)
json_query = xbmc.executeJSONRPC(details_query_string)
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = simplejson.loads(json_query)
Expand All @@ -287,8 +297,13 @@ def getDetails(self):
self.audiostreams = json_response['result']['audiostreams']
self.subtitles = json_response['result']['subtitles']
log(LOG_DEBUG, json_response )

genre_tags_query_string = '{"jsonrpc": "2.0", "method": "Player.GetItem", "params": { "properties": ["genre", "tag"], "playerid": 1 }, "id": 1}'
genre_tags_query_dict = {"jsonrpc": "2.0",
"method": "Player.GetItem",
"params": { "properties":
["genre", "tag"],
"playerid": activePlayerID },
"id": 1}
genre_tags_query_string = simplejson.dumps(genre_tags_query_dict)
json_query = xbmc.executeJSONRPC(genre_tags_query_string)
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = simplejson.loads(json_query)
Expand Down

0 comments on commit 575f2a0

Please sign in to comment.