1st test is xbmc is alive by trying to open the Socket to ip:port.
PHP would be
Code:
public static function checkOnLine($server, $port, $name){
preg_match("/^(http:\/\/)?([^\/]+)/i", "$server", $match);
$host = $match[2];
preg_match_all("/\.([^\.\/]+)/",$host, $match);
$host = trim($host);
$socket = "";
@$socket = fsockopen("$host", $port, $errno, $errstr, 2);
if(!$socket) return false;
else {fclose($socket);
return true;}
}
2. Test for Ping by calling ping. You can try FireFox's RESTClient. Set HTTP header to "Content-Type = application/json", POST method to
http://ip:port/jsonrpc
Code:
{"jsonrpc":"2.0","method":"JSONRPC.Ping","id":"1"}
3. Get the active Player ID
Code:
{"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}
4. Use the result to create the Now playing Json
Code:
{"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":1,"properties":["title","showtitle","season","episode"]},"id":"1"}
Parsing the results depend what you are using, PHP, c#, java...
http://forum.xbmc.org/showthread.php?tid=125631
I',m trying to expand the new playing by having the duration of how much has been watched out from total time included.. i.e. progressbar..
Can anyone help with this one..