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)



tvdb id for episode - othrayte - 2011-06-17

What is the recommended method to get the tvdb id that is stored in the db for a certain episode, why can't I get this with VideoLibrary.GetEpisodeDetails, the Library.Fields.Episode doesn't have a value for the tvdb id or even for the imdb id that is available from VideoLibrary.GetTVShowDetails.

And is this page http://wiki.xbmc.org/index.php?title=JSON_RPC maintained by hand, because the Library.Fields.Episode section doesn't list the avaliable fields which for reference are [ "title", "plot", "votes", "rating", "writer", "firstaired", "playcount", "runtime", "director", "productioncode", "season", "episode", "originaltitle", "showtitle", "cast", "streamDetails", "lastplayed", "fanart", "thumbnail", "file" ].


Playing any media with Play() - cinusek - 2011-06-18

In my utility I want XBMC to display any kind of media it supports. I am using the XBMC.Play method and pass it URL to the resource on the Internet.

It works fine with video files but not with images. The same images are displayed correctly when I use UPnP to control XBMC but I prefer json-rpc.

Is the Play method limited by design or is it a bug that I need to report?

I've tested on XBMC 10.1 on Windows and a bit older version on Linux.


- Montellese - 2011-06-18

I want to start with an FYI: With commit 482cb54953c7a450a4ff you can now use GetRecentlyAddedAlbums and GetRecentlyAddedSongs in the AudioLibrary namespace.

othrayte Wrote:What is the recommended method to get the tvdb id that is stored in the db for a certain episode, why can't I get this with VideoLibrary.GetEpisodeDetails, the Library.Fields.Episode doesn't have a value for the tvdb id or even for the imdb id that is available from VideoLibrary.GetTVShowDetails.
XBMC does not store a tvdb id per episode but only per tvshow so that's why you can't retrieve it on a per episode base.

othrayte Wrote:And is this page http://wiki.xbmc.org/index.php?title=JSON_RPC maintained by hand, because the Library.Fields.Episode section doesn't list the avaliable fields which for reference are [ "title", "plot", "votes", "rating", "writer", "firstaired", "playcount", "runtime", "director", "productioncode", "season", "episode", "originaltitle", "showtitle", "cast", "streamDetails", "lastplayed", "fanart", "thumbnail", "file" ].
No the current status of that page was autogenerated but as you can see it is far from perfect. Managing it by hand would be a too time-consuming task. Furthermore with some of my recent changes I broke my tool to auto-generate the wiki article so that's why there are no updates right now.

cinusek Wrote:In my utility I want XBMC to display any kind of media it supports. I am using the XBMC.Play method and pass it URL to the resource on the Internet.

It works fine with video files but not with images. The same images are displayed correctly when I use UPnP to control XBMC but I prefer json-rpc.

Is the Play method limited by design or is it a bug that I need to report?

To view images you should use the XBMC.StartSlideshow() command but that one currently only accepts a directory as a parameter. Please create a feature request ticket on trac and when I got the time I'll look into it and see in which command it will fit best.


- othrayte - 2011-06-18

Montellese Wrote:XBMC does not store a tvdb id per episode but only per tvshow so that's why you can't retrieve it on a per episode base.

Yes, but nether does it store the title of the show ('showtitle') for each episode, so it would already have to got to the tvshow to get that. Each episode has an entry for the associated tvshowid and as such is associated with a specific 'tvshow' and that is where the 'tvdbnumer' would come from.

I would just use GetTVShowDetails (ie pull the associated tvshow entry) for the episode except that the jsonrpc currently has no way (that i've found) of getting the tvshowid given the episodeid which i would need to pass to that method.

Thanks for your help and I understand now about the wiki, maybe it would be useful to have a link somewhere to the raw interface definition.


- Montellese - 2011-06-18

othrayte Wrote:Yes, but nether does it store the title of the show ('showtitle') for each episode, so it would already have to got to the tvshow to get that. Each episode has an entry for the associated tvshowid and as such is associated with a specific 'tvshow' and that is where the 'tvdbnumer' would come from.

I would just use GetTVShowDetails (ie pull the associated tvshow entry) for the episode except that the jsonrpc currently has no way (that i've found) of getting the tvshowid given the episodeid which i would need to pass to that method.

I am working on providing the IDs for genre, sets, tvshows etc (depending on the object) in such calls so that would solve your problem.

othrayte Wrote:Thanks for your help and I understand now about the wiki, maybe it would be useful to have a link somewhere to the raw interface definition.

IMO the best you can do is either use the simple JSONRPC.Introspect call or if you use a very recent nightly build you could make even better use of it by using the newly introduced "filter" parameter which lets you view the json schema definition of a single method (which is much easier to read than the full introspect output).


- othrayte - 2011-06-18

Montellese Wrote:I am working on providing the IDs for genre, sets, tvshows etc (depending on the object) in such calls so that would solve your problem.

I had found that I can fall back to just the title ect for the moment, but I'll defiantly be looking out for this so that I can make own add-on properly robust. This does seem like the most logical way of doing it, it could become a nightmare if episode details had to support every thing from tvshow or genre.


- Nick8888 - 2011-06-19

Could someone tell me which call will play a song from its songid. i.e. clear playlist and play the song.

XBMC.Play used to be able to do this but now cannot take a songid as a param.

I know this can be done with separate calls but I'd prefer to do it with one.


- carmenm - 2011-06-20

I was wondering if it was already possible to send multiple commands at once in one single json call?
it would be very helpful when you want for example to:
- clear the VideoPlaylist
- insert multiple items in it
-start playing
All at once (which would require the commands to be performed in the right order)

Thanks


- topfs2 - 2011-06-20

carmenm Wrote:I was wondering if it was already possible to send multiple commands at once in one single json call?
it would be very helpful when you want for example to:
- clear the VideoPlaylist
- insert multiple items in it
-start playing
All at once (which would require the commands to be performed in the right order)

Thanks

check batch requests in json-rpc 2.0 spec (essentially array of requests), we support them in mainline. Not sure if we do in dharma though


- Montellese - 2011-06-20

It's not available for Dharma.


- carmenm - 2011-06-20

I am using the nightly builds, so it should it be available. right?

Thanks


- Montellese - 2011-06-20

Yeah it should. You should be able to send them in a single HTTP request or over TCP by putting all the jsonrpc requests in an array
Code:
[
{ "jsonrpc": "2.0", .... },
...
{ "jsonrpc": "2.0", .... }
]



- carmenm - 2011-06-20

Just tested it. It works like a charm!!!!

THANK YOU, you made my day


- Montellese - 2011-06-22

I just made a few commits to fix a few bugs and add new functionality. There are two new methods Export and Clean in AudioLibrary and VideoLibrary and ScanForContent has been renamed to Scan. Furthermore the "thumbnail" field is now always returned when it is requested even if it's empty.


XBMC.Play error - pfeifer - 2011-06-24

I am trying to use XBMC.Play

I am using XBMC Git:20110623-b2c2053

This is my python command

Code:
{
    \"jsonrpc\": \"2.0\",
    \"method\": \"XBMC.Play\",
    \"params\": {
        \"file\": \"C:\\Users\\alex\\Videos\\myfilm.avi\",
        \"type\": \"video\"
    },
    \"id\": 1
}

Don't work.

Where is the error?

Bye


Pfeifer