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)



- thedroid - 2011-06-30

Montellese Wrote:That is because you have to use the "videotitle" sort method and not the "title" sort method for videos.

Thanks for the clarification.


Querys - thedroid - 2011-06-30

Are there any plans to provide a query option such as

Code:
{"id":7,"jsonrpc":"2.0","method":"VideoLibrary.GetMovies","params":{"fields":["title"],"query":{"method":"videotitle","contains":"transformers"}}}



- topfs2 - 2011-06-30

thedroid Wrote:Are there any plans to provide a query option such as

Code:
{"id":7,"jsonrpc":"2.0","method":"VideoLibrary.GetMovies","params":{"fields":["title"],"query":{"method":"videotitle","contains":"transformers"}}}

Yeah, some form of "search" is planned, we aren't totally sure how to do it just yet though. A ticket for discussing it would be very nice, with good examples about how to achieve it.

Currently the database doesn't really have the hooks so we would need to implement that also afaik (not a problem just makes the problem larger), so if someone could create sql statements along with the examples that would also be very appreciated.

I must say I kindof like the query idea but we could probably do it more general. i.e. query": ["videotitle contains transformers"] the question is mostly how to handle the and/or stuffs though.


- thedroid - 2011-06-30

topfs2 Wrote:A ticket for discussing it would be very nice, with good examples about how to achieve it.

A similar ticket is currently in tracker already

[HTML][/HTML]execute SQL statements via JSON-RPC

Should I add to this or create a new ticket?


- topfs2 - 2011-06-30

thedroid Wrote:A similar ticket is currently in tracker already

[HTML][/HTML]execute SQL statements via JSON-RPC

Should I add to this or create a new ticket?

Please open a new with just search (generally one per method), that one you linked to i almost want to close as its very unclear, i think its more about edit of items than general SQL statements.


- thedroid - 2011-07-01

topfs2 Wrote:Please open a new with just search

Created

http://trac.xbmc.org/ticket/11697


- markus101 - 2011-07-04

Hello,

I've just started looking at the JSON interface, I'm currently accessing it via HTTP, which is working great. There is currently one thing I'm looking for, is there a way to get the path of a TV Show with "VideoLibrary.GetTvShows"? I see for Episodes I can get the file, the same for Movies, hoping the same exists for GetTvShows.

I attempted to use, directory, path, folder, dir, to no avail.

Edit: I've been testing against both Dharma (my main setup) and the latest nightly from XBMC.org (20110703-36d20e9), if i pass the field "file" to Dharma, I get a response, without that field, If I pass the same field to the nightly I get an empty string back (progress!).
I also gave GetTvShowDetails a shot with the field "file", method not implemented on Dharma, but on the nightly I get a valid response with the file filled out.

Based on what I've uncovered now it seems I will need Bleeding Edge/Eden to support what I'm looking for, but I'm hoping to save the extra step of having to get the details for a TvShow, though that is less of a concern.

I'd appreciate any help with this.

Cheers,

Markus


- Montellese - 2011-07-04

markus101 Wrote:Based on what I've uncovered now it seems I will need Bleeding Edge/Eden to support what I'm looking for, but I'm hoping to save the extra step of having to get the details for a TvShow, though that is less of a concern.

That was a bug and I just fixed it so it should be available in the nightly build of tomorrow. Thanks for letting us know.


- topfs2 - 2011-07-04

markus101 Wrote:Hello,

I've just started looking at the JSON interface, I'm currently accessing it via HTTP, which is working great. There is currently one thing I'm looking for, is there a way to get the path of a TV Show with "VideoLibrary.GetTvShows"? I see for Episodes I can get the file, the same for Movies, hoping the same exists for GetTvShows.

I attempted to use, directory, path, folder, dir, to no avail.

Edit: I've been testing against both Dharma (my main setup) and the latest nightly from XBMC.org (20110703-36d20e9), if i pass the field "file" to Dharma, I get a response, without that field, If I pass the same field to the nightly I get an empty string back (progress!).
I also gave GetTvShowDetails a shot with the field "file", method not implemented on Dharma, but on the nightly I get a valid response with the file filled out.

Based on what I've uncovered now it seems I will need Bleeding Edge/Eden to support what I'm looking for, but I'm hoping to save the extra step of having to get the details for a TvShow, though that is less of a concern.

I'd appreciate any help with this.

Cheers,

Markus

Uhm sounds like nightly have a bug then. Tvshows and season cant have a directory coupled with them. Episodes of the same show can be spread out over many sources and directories. Same goes with albums and artists.


- markus101 - 2011-07-04

Montellese Wrote:That was a bug and I just fixed it so it should be available in the nightly build of tomorrow. Thanks for letting us know.

Thanks, I'll check it out.

topfs2 Wrote:Uhm sounds like nightly have a bug then. Tvshows and season cant have a directory coupled with them. Episodes of the same show can be spread out over many sources and directories. Same goes with albums and artists.
Hmm, I hadn't thought of that (WHS keeps everything in one place for me), thanks for the information.

-Markus


- wsnipex - 2011-07-10

I'm trying to send a on screen Notification on latest git build.
Is this the correct way to do it?

Code:
{"jsonrpc": "2.0", "method": "JSONRPC.NotifyAll", "params": {"sender": "wsuxbackup", "message": "test"}, "id": "1"}
{
        "id": "1",
        "jsonrpc": "2.0",
        "result": "OK"
}

it returns with OK and I see it in the debug log, but nothing appears on screen Confused

I tought I maybe have to set notification flag, but I cannot get it to work:
Code:
{"jsonrpc": "2.0", "method": "JSONRPC.SetNotificationFlags", "params": {"player": true, "gui": true, "system": true, "videolibrary": true, "other": true, "audiolibrary": true}, "id": "1"}
{
        "error": {
                "code": -32602,
                "data": {
                        "message": "Too many parameters",
                        "method": "JSONRPC.SetNotificationFlags"
                },
                "message": "Invalid params."
        },
        "id": "1",
        "jsonrpc": "2.0"
}



- topfs2 - 2011-07-10

wsnipex Wrote:I'm trying to send a on screen Notification on latest git build.
Is this the correct way to do it?

Code:
{"jsonrpc": "2.0", "method": "JSONRPC.NotifyAll", "params": {"sender": "wsuxbackup", "message": "test"}, "id": "1"}
{
        "id": "1",
        "jsonrpc": "2.0",
        "result": "OK"
}

it returns with OK and I see it in the debug log, but nothing appears on screen Confused

I tought I maybe have to set notification flag, but I cannot get it to work:
Code:
{"jsonrpc": "2.0", "method": "JSONRPC.SetNotificationFlags", "params": {"player": true, "gui": true, "system": true, "videolibrary": true, "other": true, "audiolibrary": true}, "id": "1"}
{
        "error": {
                "code": -32602,
                "data": {
                        "message": "Too many parameters",
                        "method": "JSONRPC.SetNotificationFlags"
                },
                "message": "Invalid params."
        },
        "id": "1",
        "jsonrpc": "2.0"
}

Its not a GUI notification like the Kai Toast. The notifyAll does a jsonrpc notification to other json-rpc clients.


- wsnipex - 2011-07-10

ahh, I see. thanks for the clarification.
is there way to send a GUI notification via json-rpc?


Files.GetDirectory has become extremely slow - compared to Dharma - giftie - 2011-07-10

There seems to be added code that slows down the call Files.GetDirectory when using a media type. For instance the following call:
Code:
{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "/media/hte_files/Trailers", "media": "video"}, "id": 1}
takes less than a second to complete on Dharma, but 8-10 seconds on pre-Eden(git: 4ff2ea - though shows up on much earlier versions too), the folder contains about 430 video files(trailers) and about 200 non-video files.

In the log I see:
Code:
10:41:30 T:2946804592 M:2621538304   DEBUG: GetMovieId (/media/hte_files/Trailers/127 Hours-trailer.mov), query = select idMovie from movie where idFile=3864
10:41:30 T:2946804592 M:2621538304   DEBUG: GetEpisodeId (/media/hte_files/Trailers/127 Hours-trailer.mov), query = select idEpisode from episode where idFile=3864
10:41:30 T:2946804592 M:2621538304   DEBUG: GetMusicVideoId (/media/hte_files/Trailers/127 Hours-trailer.mov), query = select idMVideo from musicvideo where idFile=3864
when the media type is specified, but not when nothing is specified(defaults to files)

Is there a way to disable this check of the database, since it is not really necessary(in this case), just trying to retrieve video(or music) that is not part of my library, which may be on a vfs in XBMC(it's for the python script Cinema Experience, btw)

If it is not, I'll add code to the script to query for files and sort the files with video extentions(or music extentions) out(though I think XBMC is a little faster, I know probably just milliseconds, but still Smile )


- jmarshall - 2011-07-11

It could probably be sped up for videos at least, as there's no point doing those calls if content is set on the folder for instance (compare CGUIWindowVideoNav::RetrieveVideoInfo())