XBMC Community Forum
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Development (/forumdisplay.php?fid=93)
+---- Forum: JSON-RPC (/forumdisplay.php?fid=174)
+---- Thread: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC (/showthread.php?tid=68263)



- el_Paraguayo - 2011-12-02 17:45

Great. I learn something new every day.

Sorry if these are really basic questions for you!


Notifications for slideshows - dwagner - 2011-12-04 18:13

Is there any notification for when a slideshow or pictures are shown?

Having this would be useful as I was prefer not to continually poll the server for when a slideshow or picture are played. Currently I use the Player.OnPlay and Player.OnStop notification to update data on what is currently playing.


- Montellese - 2011-12-04 18:27

dwagner Wrote:Is there any notification for when a slideshow or pictures are shown?

Having this would be useful as I was prefer not to continually poll the server for when a slideshow or picture are played. Currently I use the Player.OnPlay and Player.OnStop notification to update data on what is currently playing.

Currently not. The whole slideshow stuff is very badly integrated into XBMC and requires a lot of extra work for it to be available in JSON-RPC at all.


- dwagner - 2011-12-04 18:44

Montellese Wrote:Currently not. The whole slideshow stuff is very badly integrated into XBMC and requires a lot of extra work for it to be available in JSON-RPC at all.

That's quite sad, because I do see that Player.GetActivePlayers correctly retrieves the picture player.

I was using the notification system to just get info when it changed, but without getting the picture information the notification system goes out the door for me and I instead have to continually poll to see if pictures are being shown as opposed to videos and music.


- dwagner - 2011-12-04 23:57

Hi Montellese,

One other thing I've noted as I am trying to do my work arounds for pictures.

The JSON result for Player.GetItem comes back with correct picture information for file, label and type but it gives me a path to a fanart image that supposedly sits in the Video/Fanart directory. The file does not exist there.

Another issue seems to be that if you view a single image, the return has the correct thumbnail, but if you view images in a slideshow the return has no thumbnail set.


- wuench - 2011-12-06 18:25

Trying to convert my code over to Pre-Eden.

When I try to submit the following command:

{"jsonrpc":"2.0","method":"XBMC.GetInfoLabels","params":["System.CurrentControl"],"id":1}

I get back an error:
{"error":{"code":-32602,"data":{"method":"XBMC.GetInfoLabels","stack":{"message":"Invalid type string received","name":"labels","type":"array"}},"message":"Invalid params."},"id":1,"jsonrpc":"2.0"}

I can't make heads or tails out what this is trying to tell me. Is it saying the info label "System.CurrentControl" is not supported. If not, is there a list of which infolabels are supported?

I get that infolabels are deperecated, but I am more trying to figure out how to read the new docs and what array [1...x] means and the JSON schema stuff. Debugging my code, one command at a time. Some examples in the docs would be really helpful.


- Montellese - 2011-12-06 18:49

The most important thing the doc tells you is that XBMC.GetInfoLabels takes a parameter named "labels" (http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v3#XBMC.GetInfoLabels) which is not present in your request.

So you're request should look like this:
Code:
{"jsonrpc":"2.0","method":"XBMC.GetInfoLabels","pa rams":{ "labels": ["System.CurrentControl"] },"id":1}

The reason why the error message tells you that it received a string but expected an array is because it thinks you are using JSON-RPC's by position notation i.e. the parameters are not provided by their names (in this case e.g. "labels") but by their position (i.e. "params" is an array and not an object) and so XBMC thinks that "System.CurrentControl" is your first parameter.

Taking a look at both the JSON-RPC 2.0 specification and the JSON schema draft help a lot in understanding the docs.

BTW [1..x] means that the array must contain at least 1 item but can contain as many items as you want. Alternatives would be [] which means the array can take 0 to infinite items or [0..5] which means the array can take 0 to 5 items and so on.


- wuench - 2011-12-06 21:26

Yep, that worked. Thanks. I read those docs, but it's just not quite sinking in yet... So there may be more dumb questions coming... Smile


Slideshow - vasikgreif - 2011-12-09 12:42

Hi, how are picture playlists supposed to work?Do they have it's own id and how can I start slideshow?

I tried adding the picture as:
Code:
{"id":50,"jsonrpc":"2.0","method":"Playlist.Add","params":{"playlistid":1,"item":{"file":"smb://192.168.1.109/filestore/1.jpg"}}}
which adds pictures into video playlist, but I'm unable to play it...

Thanks
Vasik


- Montellese - 2011-12-09 12:50

You can either use Player.Open and pass a path to a directory with pictures in the "path" property of the "item" parameter (And optionaly specify "random" and "recursive" as well) or you can add pictures with Playlist.Add to the playlist with ID 3 (this is how it is right now but might change in the future but Playlist.GetPlaylists will tell you the available playlists, their type and ID) and then use Player.Open and pass the "playlistid" 3 in the "item" parameter.