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

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



- jimk72 - 2011-10-31

This is prob a question for programers but here it is. I got everything working with displaying thumbnails and title of movies all in a nice listview. I am still so impressed by all this but anyway it worked perfect when using 127.0.0.1 but as soon as I switched to try to controll xbmc over my network(192.168.1.110) it loads the json request in parts. I have it set to onreceive of select port process the json. using 127.0.0.1 it is recieved as 1 whole buffer. when using network it receives about half and then tries to process it and it errors. If i remove the processing part it will load the whole request but in 2 parts.

I have about 250+ movies so requesting a list of library with label and thumbnail is a lot of info to be sent.

Is there something at the end that will let me know it is the end of the request?


- Montellese - 2011-10-31

Are you using some kind of JSON library? If not you should do so or you need to start counting { and }.


- dwagner - 2011-10-31

Is there anyway to get the file dates using Files.GetDirectory. Its something I currently use with the HTTP Api that users really wanted. Would be a shame if I have to remove the feature for Eden.

Also I don't seem to be getting anything back for the "lastplayed" field, I've just checked in VideoLibrary.GetMovies and Files.GetDirectory both don't even return an empty field.

And finally, I reference JSON from the JSONRPC.Introspect, it took me awhile to get a file to play because the Introspect mentions a "path" property but it does not mention a "file" property for Player.Open.


- jimk72 - 2011-10-31

I figured it out. The amount of data to process was over 30,000char. I was using a string var to store it that could not store that much data. I set it up to store the first part In a separate var. Then combine the 2 to process. Everything is working great now. There does seem to be random violations every so often but I have no error coding inplace if there is a network prob. I just restart the program and everything works.

A quick question. When accessing xbmc that has password how do I get the images?
Currently I use:
Http://192.168.1.110/vfs/special://masterprofile/thumbnail/ect...
But I have no user or passwords on xbmc

Thanks in advanced!


- Montellese - 2011-10-31

dwagner Wrote:Is there anyway to get the file dates using Files.GetDirectory. Its something I currently use with the HTTP Api that users really wanted. Would be a shame if I have to remove the feature for Eden.
What exactly do you mean by file dates? When the files were created, modified etc? How can you retrieve that information through the HTTP API? AFAIK it's not available through JSON-RPC and as Eden is in feature freeze it won't be available in the Eden release. Please create a feature request ticket for it.

dwagner Wrote:Also I don't seem to be getting anything back for the "lastplayed" field, I've just checked in VideoLibrary.GetMovies and Files.GetDirectory both don't even return an empty field.
I'll have to investigate this when I get home this evening. Either it isn't correctly set in the database or it isn't correctly retrieved from the database.

dwagner Wrote:And finally, I reference JSON from the JSONRPC.Introspect, it took me awhile to get a file to play because the Introspect mentions a "path" property but it does not mention a "file" property for Player.Open.
It actually does if you follow the reference ("$ref") to "Playlist.Item" which can take a "file" property.

jimk72 Wrote:I figured it out. The amount of data to process was over 30,000char. I was using a string var to store it that could not store that much data. I set it up to store the first part In a separate var. Then combine the 2 to process. Everything is working great now. There does seem to be random violations every so often but I have no error coding inplace if there is a network prob. I just restart the program and everything works.
Doesn't sound like a very elegant solution.

jimk72 Wrote:A quick question. When accessing xbmc that has password how do I get the images?
Currently I use:
Http://192.168.1.110/vfs/special://masterprofile/thumbnail/ect...
But I have no user or passwords on xbmc
You need to set the credentials of the HTTP request to the username and password specified in XBMC (if present).


- dwagner - 2011-10-31

Montellese Wrote:What exactly do you mean by file dates? When the files were created, modified etc? How can you retrieve that information through the HTTP API? AFAIK it's not available through JSON-RPC and as Eden is in feature freeze it won't be available in the Eden release. Please create a feature request ticket for it.
Modified date. In the http API you could run a GetMediaLocation and specify a "showdate" option to get the modified dates with the files. The only negative is that the dates arrive in the xbmc locale setting and you could not query that so I had to make some assumptions in order to parse the date correctly.

I guess I'll have to cut this out for Eden, until you get a chance to go through feature requests. Hopefully not too many unhappy users. I'll create a feature request ticket now. I've bombarded the JSON feature requests as I have been trying to get the same functionality as the HTTP api working in JSON.

Montellese Wrote:I'll have to investigate this when I get home this evening. Either it isn't correctly set in the database or it isn't correctly retrieved from the database.
Thanks. I use that as well when listing files for users in SoulMote.

Keep up the good work.


- Montellese - 2011-10-31

dwagner Wrote:I guess I'll have to cut this out for Eden, until you get a chance to go through feature requests. Hopefully not too many unhappy users. I'll create a feature request ticket now. I've bombarded the JSON feature requests as I have been trying to get the same functionality as the HTTP api working in JSON.
Such feedback is more than welcome. Only few people provide detailed information on what is still missing in JSON-RPC. Obviously we might get rid of some features available in the HTTP API but as I never used the HTTP API myself it's hard to know what is still missing in JSON-RPC.

I already got a bunch of work ready which will be made available in nightlies as soon as Eden has been released and after that I'll go through as many feature requests as possible.


- Montellese - 2011-10-31

dwagner Wrote:Also I don't seem to be getting anything back for the "lastplayed" field, I've just checked in VideoLibrary.GetMovies and Files.GetDirectory both don't even return an empty field.

Fixed in https://github.com/xbmc/xbmc/commit/1409e7872e551d71f4c6d2d166bbadded3b68ead . Thanks for the report.


- jimk72 - 2011-11-01

I fixed all the probs I was having. it was delays in the network that would break the returned json into seperate parts. I now use multiple strings to wait until the complete json is recieved then pass it to the json object parser. I wish I knew more about coding in c++ and had more time to contribute. you guys are doing a great job! I have my listview that shows all the movies just like you are in xbmc and double clicking will start to play the movie and update the currently playing display. This is the best part about open source. I wish I had this much control over itunes Sad I guess I will have to try xbmc music library and see how it handles all my music.

I am using a cache folder that saves all the thumbnails as bmp images the size I need so once you run it ounce the listview is almost instant and will download any new thumbs it needs. I will be looking into doing the same for music although the thought of 1,000s of images for covers doesnt seem feasable but will look into it just the same.

My question is as far as I can tell all thumbnails have the same name regardless of what pc or xbox the xbmc was installed on so a single cache folder should work correct? im talking about the tbn filename. so a movie like Due Date will always have the same tbn filename regardless of xbmc installation.


- topfs2 - 2011-11-01

jimk72 Wrote:I fixed all the probs I was having. it was delays in the network that would break the returned json into seperate parts. I now use multiple strings to wait until the complete json is recieved then pass it to the json object parser.

Its rather common on socket connections that you might not get data in "chunks" and not neatly packaged per json object Smile http abstracts this away however by always giving http packages (which will in jsonrpc contain one json rpc result (batched or not))


- grywnn - 2011-11-01

Will post a bug report, but i thought i'd mention it here too:
If i start video playback through while a screensaver is active, the screensaver keeps running while the video is playing.
Most screensavers run in the background, but the "dim" screensaver causes the whole video to be dimmed.
I'm using VideoPlaylist.Play to start playback.

I'm currently sending an extra keyboard event through the event server when starting playback to stop the screensaver, but IMHO it should be XBMCs job to cancel the sv when video playback is started Smile


- Montellese - 2011-11-01

grywnn Wrote:Will post a bug report, but i thought i'd mention it here too:
If i start video playback through while a screensaver is active, the screensaver keeps running while the video is playing.
Most screensavers run in the background, but the "dim" screensaver causes the whole video to be dimmed.
I'm using VideoPlaylist.Play to start playback.

I'm currently sending an extra keyboard event through the event server when starting playback to stop the screensaver, but IMHO it should be XBMCs job to cancel the sv when video playback is started Smile

The fact that you are using VideoPlaylist.Play tells me that you are either using Dharma or an old nightly build. This bug has been reported before and it should be fixed in the recently nightly builds. When my monitor is dimmed because of the screensaver and I use the webinterface to start a movie it un-dims the screen before starting playback.


- grywnn - 2011-11-01

Montellese Wrote:The fact that you are using VideoPlaylist.Play tells me that you are either using Dharma or an old nightly build. This bug has been reported before and it should be fixed in the recently nightly builds. When my monitor is dimmed because of the screensaver and I use the webinterface to start a movie it un-dims the screen before starting playback.

Sorry, got my own code wrong.
Actually i'm using Player.Open, and got this issue both on my Linux Pre-11.0 PVR build from oct. 22nd and on my Mac with todays nightly.
Looks like only the "dim" screensaver is affected - all other screensavers i tested stopped while playback was running but started again as soon as playback stops (instead of waiting 3 minutes again).

I'll update the track accordingly and attach an log, too.


- jimk72 - 2011-11-04

Not sure if this is a bug but when I start a movie in xbmc the onplay gives player Id 1 and when I play music in xbmc it gives id of 0. Which works fine but if I am listening to music and call player.open and send movieid it returns an onplay with playerid 0 when actually it should be 1. Calling a getitem with player 0 returns error but getitem playerid 1 returns the movie info?
Clicking movie in xbmc when playing music switches playerid back to 1. My guess is calling player.open isn't switching the playerid properly.

After further testing I've also received a playerid of -1 from an onplay notification.


- Montellese - 2011-11-05

That sounds like it's related to the problem that items started through Player.Open or recentlyadded etc are not added to a playlist. I'll have to investigate. Thanks for the report.