Check if other clients are playing before...
#16
(2014-03-19, 20:00)el_Paraguayo Wrote: That's the result of the GetActivePlayers which is what my code in post #6 is testing.

I think you then need to use the Player.GetItem method with the playerID (which you can get from the above request). This seems to be what's being shown in this line:
Code:
15:18:33 T:3948  NOTICE: {u'jsonrpc': u'2.0', u'id': 2, u'result': {u'item': {u'type': u'movie', u'id': 1, u'label': u'The Bag Man'}}}
Mmmmm to much stuff on my mind. Anyway if it was GetActivePlayers or GetItem, in both cases I was unable to check for specific item like I mentioned before.
Wiki says it's a object http://wiki.xbmc.org/?title=JSON-RPC_API...er.GetItem but I was unable to check for type is movie or label is bag man.
Sorry for these stupid questions, my Python skills are basic
Reply
#17
OK - I've just done a really simple test at home, and this works:
Code:
from xbmcjson import XBMC

myxbmc = XBMC("YOURHOST/jsonrpc")

players = myxbmc.Player.GetActivePlayers().get("result")

if players:
    for player in players:
        playerid = player["playerid"]
        playingitems = myxbmc.Player.GetItem({"playerid": playerid})
        playingitem = playingitems.get("result")
        if playingitem:
            print "Playing Item Found!"
            print "Type: %s" % playingitem["item"]["type"]
            print "Title: %s" % playingitem["item"]["label"]
This gave me:
Code:
Playing Item Found!
Type: movie
Title: The Big Lebowski.mkv
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#18
(2014-03-20, 02:19)el_Paraguayo Wrote: OK - I've just done a really simple test at home, and this works:
Code:
from xbmcjson import XBMC

myxbmc = XBMC("YOURHOST/jsonrpc")

players = myxbmc.Player.GetActivePlayers().get("result")

if players:
    for player in players:
        playerid = player["playerid"]
        playingitems = myxbmc.Player.GetItem({"playerid": playerid})
        playingitem = playingitems.get("result")
        if playingitem:
            print "Playing Item Found!"
            print "Type: %s" % playingitem["item"]["type"]
            print "Title: %s" % playingitem["item"]["label"]
This gave me:
Code:
Playing Item Found!
Type: movie
Title: The Big Lebowski.mkv
Thanks, seems i forgot .get("result") when doing Player.GetActivePlayers() and GetItem
Now it works here also Wink
Reply
#19
Great. Glad I could help.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply

Logout Mark Read Team Forum Stats Members Help
Check if other clients are playing before...0