Kodi Community Forum

Full Version: Using JSON-RPC ...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

Just having issues JSON-RPC with the Eden Nightlies, so I wanted to list out a couple of examples.

1) Retrieve Information from XBMC with a Command

{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": 1 }

2) Retrieve Information from XBMC with a Command and a Parameter

{ "jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "properties": [ "playcount" ] }, "id": 1 }

3) Retrieve Information from XBMC with a Command and more than 1 Parameter

{ "jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "properties": [ "playcount", "year" ] }, "id": 1 }

So, those all work, but the one I'm currently having issue with is ...

Player.GetItem

USING: { "jsonrpc": "2.0", "method": "Player.GetItem", "params": { "playerid": 1 }, "id": 1 }
or
USING: { "jsonrpc": "2.0", "method": "Player.GetItem", "params": { "playerid": 1, "properties": ["title"] }, "id": 1 }

ERROR: {"error":{"code":-32100,"message":"Failed to execute method."},"id":1,"jsonrpc":"2.0"}

Any ideas what the appropriate call is for Player.GetItem ?
You first need to call Player.GetActivePlayers to see which player is active and then use the "playerid" you got from that response to call Player.GetItem. Player.GetItem (and all the other Player methods) will return "Failed to execute method" if you pass a playerid to a player which is not active.
Ah cool ... thanks for that. I did have something playing initially when I started testing, but it had obviously stopped and I thought if it was stopped it would bring back 0 or Nothing Playing as it's status. So, good to know.

Thanks for pointing me in the right direction.
Thank you aswell. I've also been working with this new-world.
http://forum.xbmc.org/showthread.php?tid=125631
Smile