JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC

  Thread Rating:
  • 7 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
jimk72 Offline
Senior Member
Posts: 148
Joined: Jan 2005
Reputation: 0
Post: #1381
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?
find quote
Montellese Online
Team-XBMC Developer
Posts: 2,830
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #1382
Are you using some kind of JSON library? If not you should do so or you need to start counting { and }.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
dwagner Offline
Member+
Posts: 135
Joined: Feb 2011
Reputation: 0
Location: Johannesburg
Post: #1383
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.
find quote
jimk72 Offline
Senior Member
Posts: 148
Joined: Jan 2005
Reputation: 0
Post: #1384
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://maste...mbnail/ect...
But I have no user or passwords on xbmc

Thanks in advanced!
find quote
Montellese Online
Team-XBMC Developer
Posts: 2,830
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #1385
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://maste...mbnail/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).

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
dwagner Offline
Member+
Posts: 135
Joined: Feb 2011
Reputation: 0
Location: Johannesburg
Post: #1386
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.
find quote
Montellese Online
Team-XBMC Developer
Posts: 2,830
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #1387
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.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
Montellese Online
Team-XBMC Developer
Posts: 2,830
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #1388
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/1409...ded3b68ead . Thanks for the report.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
jimk72 Offline
Senior Member
Posts: 148
Joined: Jan 2005
Reputation: 0
Post: #1389
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.
find quote
topfs2 Offline
Team-XBMC Developer
Posts: 3,852
Joined: Dec 2007
Reputation: 8
Post: #1390
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))

If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
Post Reply