[ALL] HTTPAPI to retrieve current status?
#1
Hi there.
Using Eden RC2 at the moment on Win7 platform.

Is there more structured way to ask XBMC what is the system now playing besides
Code:
http://ip:port/xbmcCmds/xbmcHttp?command=getcurrentlyplaying
? This will result <html><li>.... structure and is not the best way to parse thing out from it: Movies,Files and TV shows have different out structure.

XWMM looks really good but just need to ask what the system is playing at given time.. that needs to be lite.
XML-out format could be nice.

EDIT: JSON RPC?
http://wiki.xbmc.org/index.php?title=JSON_RPC
RestClient? This is overkill for me. Smile Have to make this happen with PHP5.x... Any help?

edit: Ok, Found one PHP Rest Client https://github.com/educoder/pest and
Api is http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v3

Smile
Reply
#2
For Chrome & FireFox there are great Rest Client (from Chao ZHOU).
Can anyone give some pointer of how to query.. anything..
Reply
#3
Using Eden RC2.

So, with POST method to http://<your-ip>::<configured port>/jsonrpc. (JSON-RPC API v4 (Eden))?

In the data area comes the "payload" i.e. query, but must the Http header also be filled with ... mime?
Reply
#4
Can anyone give even a small hint on how to Query with fox/chrome's Rest client something.. player status?
Reply
#5
ok.. I got FireFox REST client to work..sort of.. Xbmc v11.0

REST Method = POST,
Code:
http://ip:port/jsonrpc
RequestBody =
Code:
{"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}
and result is

Code:
{"id":1,"jsonrpc":"2.0","result":[{"playerid":1,"type":"video"}]}

(DVD movie is playing)
So the playerID is 1.

How to ask for the name of the movie playing?
Reply
#6
Well..
Code:
{ "jsonrpc": "2.0", "method": "Player.GetItem", "params": { "playerid": 1, "properties": ["title"] }, "id": 1 }
Seems to work.. TV-Series, Video and Movies show different result


Refering to Here
Reply
#7
For PHP implementation use This RESTClient

Ping is
Code:
$JSON = array(
    "jsonrpc"=>"2.0",
    "method"=>"JSONRPC.Ping",
    "id"=>"1"
    );
$ping = RestClient::post("http://ip:port/jsonrpc",json_encode($JSON,true),"","","application/json");

Dump the result into array..
Code:
var_dump(json_decode($ping->getResponse(), true));

Result is
Code:
array(3) { ["id"]=> string(1) "1" ["jsonrpc"]=> string(3) "2.0" ["result"]=> string(4) "pong" }

Reply
#8
I did it. I have fully functional PHP implementation to ask for current playing movie/tv-series/video.
So it's doable.
Smile
Reply
#9
(2012-04-18, 17:21)realjobe Wrote: I did it. I have fully functional PHP implementation to ask for current playing movie/tv-series/video.
So it's doable.
Smile

Can you post your PHP code? I am trying to do something simular, http://forum.xbmc.org/showthread.php?tid=133695

My problem right now is I have live streams that start as paused ( to buffer), if I press play if will turn off my monitor. My goal is to convert my PHP HTTP code into a json, then make it all a plugin. I need to retrieve the status of XBMC and if it is not play and my monitor is on then I dont need it to turn my monitor off.

Reply

Logout Mark Read Team Forum Stats Members Help
[ALL] HTTPAPI to retrieve current status?0