Hi all,
I'm trying to have the PC with the database shutdown automatically if it doesn't detect any of its clients are streaming media via XBMC.
Reading this and this shed very little light on a potential solution though I suspect it's doable. Very frustrating. I'm the kind to learn by example and don't find the documentation very helpful in that respect. Thus I need help getting a real life example of what can be done with this API regarding what I'm trying to achieve.
TIA
looking for JSON API example... and solution.
nanouk76
Junior Member Posts: 40 Joined: Aug 2011 Reputation: 1 |
2012-05-04 23:48
Post: #1
ASUS Motherboard M5A78L-M/USB3 // 8 GB RAM Nvidia GeForce GT 430 graphics card // 2 GB RAM Ubuntu upgraded to 12.04 LTS XBMC v.11 Eden |
| find quote |
wuench
Member Posts: 56 Joined: Dec 2010 Reputation: 0 |
2012-05-05 15:02
Post: #2
It is a bit of a climb to understand the API docs. I recommend you build the foundations and send examples with your player in various states. You can do it with TCP sockets or you can use the HTTP interface, but you will need to send a POST not a GET to http://yourpc/jsonrpc, so you can't just use a browser. That was the method I followed in writing my XBMC driver for CQC.
Specifically I think the following command and example response will tell you if a player is active and which one: Code: COMMAND: {"jsonrpc":"2.0","method":"Player.GetActivePlayers","id":1}
(This post was last modified: 2012-05-05 15:03 by wuench.)
|
| find quote |
nanouk76
Junior Member Posts: 40 Joined: Aug 2011 Reputation: 1 |
2012-05-05 16:01
Post: #3
(2012-05-05 15:02)wuench Wrote: It is a bit of a climb to understand the API docs. I recommend you build the foundations and send examples with your player in various states. You can do it with TCP sockets or you can use the HTTP interface, but you will need to send a POST not a GET to http://yourpc/jsonrpc, so you can't just use a browser. That was the method I followed in writing my XBMC driver for CQC.Sorry to be such a noob but what do I do with that using curl for example if i want to query IP 192.168.0.50? This is what I tried : Code: ~$ curl --data-binary '{ "jsonrpc": "2.0", "method": "GetActivePlayers", "id":1}' -H 'content-type: application/json;' http://192.168.0.50:9000/jsonrpcASUS Motherboard M5A78L-M/USB3 // 8 GB RAM Nvidia GeForce GT 430 graphics card // 2 GB RAM Ubuntu upgraded to 12.04 LTS XBMC v.11 Eden
(This post was last modified: 2012-05-05 16:15 by nanouk76.)
|
| find quote |
wuench
Member Posts: 56 Joined: Dec 2010 Reputation: 0 |
2012-05-05 19:11
Post: #4
I haven't tried it with curl. But the syntax looks right to me. Are you sure 9000 is the correct port, the default web server port is usually 8080. I think 9000 is for TCP socket connections.
|
| find quote |
nanouk76
Junior Member Posts: 40 Joined: Aug 2011 Reputation: 1 |
2012-05-05 23:37
Post: #5
(2012-05-05 19:11)wuench Wrote: I haven't tried it with curl. But the syntax looks right to me. Are you sure 9000 is the correct port, the default web server port is usually 8080. I think 9000 is for TCP socket connections.You're right, I got the port wrong. I changed it to 8085. So this is what I get now: Code: {"error":{"code":-32601,"message":"Method not found."},"id":1,"jsonrpc":"2.0"}Code: {"result":[{"playerid":1,"type":"video"}]}ASUS Motherboard M5A78L-M/USB3 // 8 GB RAM Nvidia GeForce GT 430 graphics card // 2 GB RAM Ubuntu upgraded to 12.04 LTS XBMC v.11 Eden |
| find quote |
wuench
Member Posts: 56 Joined: Dec 2010 Reputation: 0 |
2012-05-06 14:18
Post: #6
Yep that's right. Sorry I forgot that command's response changed with Eden, the example I posted was from Dharma.
|
| find quote |

Search
Help