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)



- mzanetti - 2011-05-09

I just have discovered that also "runtime" is not set in that case.


- hippojay - 2011-05-10

Montellese

Is it possible to reference VideoLibrary.GetMovieSetDetails by setname as well as setid. Or GetMovies to return the setid.

I'm running getMovies to pull all the data down, but need to build a link to the set and then to the set contents. This means a second layer of menus, which isn't a problem - but becuase I have no persistance in plugins, at the moment it's going to require some code to pull out all sets, match the name, get the setid and push that into getMovieSetDetails.


EDIT: Also, is there a way of returning all fields without having to specifiy them individually. I've lost count of the number of times i've ran into:
Code:
"Received value does not match any of the defined enum values"



- Montellese - 2011-05-10

hippojay Wrote:Is it possible to reference VideoLibrary.GetMovieSetDetails by setname as well as setid. Or GetMovies to return the setid.

I'm running getMovies to pull all the data down, but need to build a link to the set and then to the set contents. This means a second layer of menus, which isn't a problem - but becuase I have no persistance in plugins, at the moment it's going to require some code to pull out all sets, match the name, get the setid and push that into getMovieSetDetails.
Yeah I know that this is a bit of a nuisance to get. The problem is that I wouldn't recommend using the "set" (and "cast") fields for GetMovies anyway because it adds quite a bit of extra time to retrieve that extra information for every movie. I'll see if I can provide the setid because I can see that it would simplify things quite a lot if you want to provide a movie browsing experience identical to the one in XBMC's movie library views.


hippojay Wrote:EDIT: Also, is there a way of returning all fields without having to specifiy them individually. I've lost count of the number of times i've ran into:
Code:
"Received value does not match any of the defined enum values"

Hm you should be able to get all valid enum values for the "fields" parameter from introspect. What I'd do is copy them all into an array in my program and then remove the ones I don't need. Maybe I can take a look at extending the error message to provide the actual enum value that failed. I guess that would certainly help in identifying the problem quickly.


- hippojay - 2011-05-10

Montellese Wrote:Yeah I know that this is a bit of a nuisance to get. The problem is that I wouldn't recommend using the "set" (and "cast") fields for GetMovies anyway because it adds quite a bit of extra time to retrieve that extra information for every movie. I'll see if I can provide the setid because I can see that it would simplify things quite a lot if you want to provide a movie browsing experience identical to the one in XBMC's movie library views.

Thanks - I'm using XBMCs library to display the library so I have to grab pretty much all the data at once (certainly all the "extra" info like cast and directors and the like) - not ideal but that's what we have to live with..

Being able to reference the set by name would be ideal, especially if searching movies - as you are more likely to have the name then ID. However ID will do the job fine..

Quote:Hm you should be able to get all valid enum values for the "fields" parameter from introspect. What I'd do is copy them all into an array in my program and then remove the ones I don't need.

That's what I do at the moment, perhaps it's made worse as I need them all - the line disappears waaay of the end of the screen Smile

Quote:Maybe I can take a look at extending the error message to provide the actual enum value that failed. I guess that would certainly help in identifying the problem quickly.

A "nice to have" but not something desperately needed. The error message gives the array index and, as long as everyone remembers to count from 0, pin points the problem.


- Montellese - 2011-05-10

hippojay Wrote:Thanks - I'm using XBMCs library to display the library so I have to grab pretty much all the data at once (certainly all the "extra" info like cast and directors and the like) - not ideal but that's what we have to live with..
Don't you need the cast only when displaying the details for a single movie?

hippojay Wrote:Being able to reference the set by name would be ideal, especially if searching movies - as you are more likely to have the name then ID. However ID will do the job fine..
AFAIK it will certainly be easier to provide the setid on GetMovies than providing the possibility to retrieve set details by name. Could you please create a feature request for this on trac and cc me so I don't forget? Thanks.

hippojay Wrote:A "nice to have" but not something desperately needed. The error message gives the array index and, as long as everyone remembers to count from 0, pin points the problem.

Yeah that's right. I didn't provide the actual value because theoretically an enum can also consist of objects and not strings. That makes a simple value print impossible.


- walinsky - 2011-05-10

I was wondering if there's any chance switching display modes and/or resolutions (/System/System/Video Output) could be implemented in JSON calls.
That would (finally) enable one-click switching monitors.


- hippojay - 2011-05-10

Montellese Wrote:Don't you need the cast only when displaying the details for a single movie?

Right, but from what I can see there is no way to get this information when it's actually needed. It's all front-loaded into a list structure, so I have to ge it all at once. Internal library might be different, but this how it is for plugins Sad

I'll put the feature request in. Thanks


- Montellese - 2011-05-10

Hm ok I don't really know about the addon capabilities.

What I had in mind for clients was for them to call GetMovies to retrieve some basic details like id, title, plot, thumbnail etc and list the result in whatever prefered way. Then when a movie is "activated" the client calls GetMovieDetails using the id of the specific movie and retrieve all the detailed informations (like the cast) which do not make sense to display in an overview of all movies.


- carmenm - 2011-05-11

Myself for example need to read all data at once (cast and everything)
why? because i want to do an actor list view. And as we dont have getActors (and i am not even sure i would want itTongue), i need to do a full getMovies on launch.
That s true that it s quite long but personally this is not a problem, as it s async.
I mean it doesnt stop my app for working and the user sees a "library loading".
And it s a problem only the first time, as he cant get any list until GetMovies is parsed ...

On another subject i saw the word "addon". And i have been thinking about something for quite sometimes. I want to write a plugin for xbmc to do specific tasks and i would like to control it remotely.
Could it be possible (feasible) for a plugin to add JSON methods? Something like "MyPlugin.DoAction". It would mean having a way to register for JSON method (with callback) on XBMC's side.
It would be an amazing addition but i dont know if it s even doable.

Thanks


- Montellese - 2011-05-11

carmenm Wrote:On another subject i saw the word "addon". And i have been thinking about something for quite sometimes. I want to write a plugin for xbmc to do specific tasks and i would like to control it remotely.
Could it be possible (feasible) for a plugin to add JSON methods? Something like "MyPlugin.DoAction". It would mean having a way to register for JSON method (with callback) on XBMC's side.
It would be an amazing addition but i dont know if it s even doable.

topfs2 and myself have discussed this idea as well and when I rewrote the whole JSONRPC handling I tried to make it so that it will be possible to add such functionality. So it is on my (virtual) TODO list but not very high Wink


- marksoccer - 2011-05-11

I am not getting any fanart associated with tv episodes in the now playing playlist. Is there any way to get the fanart from the tv show given the episode in the current playlist (Example, playing Seinfeld episode 34 and would like the fanart associated with the show Seinfeld)? I'm assuming I would need the tvshowid to accomplish this, but I don't think that is possible using the VideoPlaylist.GetItems method. Any ideas on how I could accomplish this task?


- Montellese - 2011-05-11

marksoccer Wrote:I am not getting any fanart associated with tv episodes in the now playing playlist. Is there any way to get the fanart from the tv show given the episode in the current playlist (Example, playing Seinfeld episode 34 and would like the fanart associated with the show Seinfeld)? I'm assuming I would need the tvshowid to accomplish this, but I don't think that is possible using the VideoPlaylist.GetItems method. Any ideas on how I could accomplish this task?

Yeah that's because the fanart doesn't belong to the episode but to the tv show (which you already assumed). The only thing you can currently do is retrieve all the tv shows (with "title" and "fanart", then get the episodes from VideoPlaylist.GetItems with "showtitle" (or whatever it was named) and then find the matching tv show from the list you retrieved earlier based on the value of "showtitle".


- carmenm - 2011-05-11

Montellese Wrote:topfs2 and myself have discussed this idea as well and when I rewrote the whole JSONRPC handling I tried to make it so that it will be possible to add such functionality. So it is on my (virtual) TODO list but not very high Wink

GREAT news. And that s obvious that it s not a priority. But so happy so see it was part of the design!

Thank you!


- sooth - 2011-05-11

<removed>

Ok, so I'm adding something via AudioPlaylist.Add. I am told it succeeds. Then I call AudioPlaylist.Play, but nothing happens. What do I actually need to do?

Code:
tester = XBMC.sendMessage("{\"jsonrpc\":\"2.0\",\"method\":\"AudioPlaylist.Add\",\"params\":{\"item\":{\"songid\":"+search+"}},\"id\":1}");

tester = XBMC.sendMessage("{\"jsonrpc\":\"2.0\",\"method\":\"AudioPlaylist.Play\", \"params\": {\"item\":1}, \"id\":2}");



- Montellese - 2011-05-11

sooth Wrote:
Code:
tester = XBMC.sendMessage("{\"jsonrpc\":\"2.0\",\"method\":\"AudioPlaylist.Add\",\"params\":{\"item\":{\"songid\":"+search+"}},\"id\":1}");
This looks fine as long as "search" is an integer variable of a valid songid.

sooth Wrote:
Code:
tester = XBMC.sendMessage("{\"jsonrpc\":\"2.0\",\"method\":\"AudioPlaylist.Play\", \"params\": {\"item\":1}, \"id\":2}");
Please try it with 0 for "item". IIRC the playlist entries start from 0 (as any index-based lists in most programming languages).