JSON for Now Playing Screen
#1
Hi there,

I'm implementing a XBMC interface over command fusion and i need a way to get to the "Now Playing" screen using JSON or something similar. How can i do it?
Reply
#2
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...
Smile
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..
Reply
#3
Has anyone got any idea on how to get movies duration/playing time as well?
Code:
{"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":1,"properties":["title","duration","season","episode"]},"id":"1"}

gets only the basic data, as:
Code:
{"id":"1","jsonrpc":"2.0","result":{"item":{"episode":-1,"id":495,"label":"Total Recall","season":-1,"title":"Total Recall","type":"movie"}}}

but with no duration...
Reply
#4
no ideas on how to get playing video's elapsed / duration time?
Reply
#5
Got it.
Code:
{"jsonrpc":"2.0","method":"Player.GetProperties","params":{"playerid":1,"properties":["percentage"]},"id":"1"}
Reply
#6
Would you care to help me with this ?

I have made an app for android but crashes often and when playing anything other then movies.

try to setup an html version of displaying name and duration on an old android phone (in a 19"case)

thanks in advance
Reply

Logout Mark Read Team Forum Stats Members Help
JSON for Now Playing Screen1