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)



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Koying - 2012-09-14

(2012-09-08, 20:58)Montellese Wrote: The reason this has to be done in JSON-RPC is because of the changes jmarshall made to the texture cache. If a user opens XBMC after an update from Eden to Frodo and he doesn't enter any of his libraries there will be 0 artwork available. If he then uses a remote client using JSON-RPC to access his library he would get 0 artwork because the artwork is being cached whenever the item is retrieved for the first time. If that first time is through JSON-RPC we have to do it there.

Didn't saw that this issue was already discussed here.
My proposed solution would be to LEFT JOIN the "art" table in the various DB views.

If thumbnail exists (which would be the vast majority), there would be no more performance impact.
If the thumbnail doesn't yet exists, as in the case of Eden upgrade or new items, it will continue the "normal" path of CVideoThumbLoader::FillLibraryArt because CGUIListItem::HasThumbnail would be false.

That wouldn't solve a "banging on the wall" issue, but it's a different one, IMO.
BTW, wouldn't it be a good idea to create a JSON-RPC sub-forum?
Discussing all the different aspects of it in a single thread seems impractical...


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-09-14

There will still be the problem of items that will never have thumb and will try to generate them on each query.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Koying - 2012-09-14

(2012-09-14, 16:20)Tolriq Wrote: There will still be the problem of items that will never have thumb and will try to generate them on each query.

Indeed, that's what I call the "banging on the wall" effect Wink
But, at least, you won't have a database open/access/close for those items with an already defined proper thumbnail, which, in day-to-day, should be 99% of them.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Mizaki - 2012-09-15

I'm some way there on the advanced filter front. Just testing and I noticed votes doesn't work with greaterthan or lessthan. Surely some mistake?

Also, is there a list of fields against accepted operators? I can guess most of them.

Shall I make an issue for:
VideoLibrary.GetActors (probably already on trac)
VideoLibrary.GetYears
VideoLibrary.GetDirectors
VideoLibrary.GetWriters (not sure about this as I don't think you can do it in the GUI either. Directors > writers eh? pfft)
VideoLibrary.GetCountry
VideoLibrary.GetStudios
GetTags (both)

Haven't started on audio yet. You only have yourself to blame btw Smile

Also, also. It might be a good idea to start a new thread for JSONRPC v5 and leave this one for v4/v2?


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-09-16

(2012-09-15, 22:26)Mizaki Wrote: I'm some way there on the advanced filter front. Just testing and I noticed votes doesn't work with greaterthan or lessthan. Surely some mistake?
The problem is probably that the number of votes is stored as a string and not as a number so it might be "12'527" and not 12527 which will throw any greater/less than comparison off. Try it with smartplaylists in XBMC. If it doesn't work there it's a general problem, otherwise it's a JSON-RPC problem (which I doubt).

(2012-09-15, 22:26)Mizaki Wrote: Also, is there a list of fields against accepted operators? I can guess most of them.
Only by reading the code in xbmc/playlists/SmartPlaylist.cpp so far. I haven't figured out a way yet to get this information into the JSON schema.

(2012-09-15, 22:26)Mizaki Wrote: Shall I make an issue for:
VideoLibrary.GetActors (probably already on trac)
VideoLibrary.GetYears
VideoLibrary.GetDirectors
VideoLibrary.GetWriters (not sure about this as I don't think you can do it in the GUI either. Directors > writers eh? pfft)
VideoLibrary.GetCountry
VideoLibrary.GetStudios
GetTags (both)
I don't think I'll add a method for every listing property. Probably makes more sense to just provide one method where you can pass in what kind of listing you are looking for and it will give it to you because for all those files there's only the label and the ID available so not much to differ.

(2012-09-15, 22:26)Mizaki Wrote: Haven't started on audio yet. You only have yourself to blame btw Smile
?

(2012-09-15, 22:26)Mizaki Wrote: Also, also. It might be a good idea to start a new thread for JSONRPC v5 and leave this one for v4/v2?
I'll inquire about a specific JSON-RPC sub-forum in the team. This thread is really hard to follow and also makes it hard for me to keep track on all the requests and questions.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - N3MIS15 - 2012-09-16

playing a smart playlist (.xsp) over json does not seem to work. I using the Playlist.Clear-->Playlist.Add(item: {file: path to .xsp})-->Player.Open method.

I have tested on eden and frodo nightlies. The playlist gets added to the queue but does not start playing.

Should this work? Or am I going about it the wrong way?


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-09-16

How does your Player.Open request look like? Have you tried just using Player.Open and providing the path to the XSP there instead of going through Playlist.Add first?


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - N3MIS15 - 2012-09-16

Code:
{"jsonrpc": "2.0", "id": 0, "method": "Playlist.Clear", "params": {"playlistid": 1}}

{"jsonrpc": "2.0", "id": 1, "method": "Playlist.Add", "params": {"playlistid": 1, "item": {"file": "special://userdata/playlists/video/movies.xsp"}}}

{"jsonrpc": "2.0", "id": 2, "method": "Player.Open", "params": {"item": {"playlistid": 1}}}

something along those lines.. im using jsonrpclib for python that uses a different method to make the calls so the above examples may not be exact.

I also tried:
Code:
{"jsonrpc": "2.0", "id": 0, "method": "Player.Open", "params": {"item": {"path": "special://userdata/playlists/video/movies.xsp"}}}

That returned "Ok" but the playlist did not play.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Mizaki - 2012-09-16

I've seen something similar as well with adding an album. I've just not had time to have a proper look. Something along:
Code:
{"jsonrpc": "2.0", "method": "Playlist.Clear", "params": { "playlistid": 0 }, "id": 1}
{"jsonrpc": "2.0", "method": "Playlist.Add", "params": {"item": {"albumid": 123}, "playlistid": 0}, "id": 1}
{"jsonrpc": "2.0", "method": "Player.Open", "params" : { "item" : { "playlistid" : 0, "position": 0 } }, "id": 1}
Adds the album but doesn't play the playlist.

Just checked. The above works with my Eden build (XVBA PVR) but does not with Frodo. It says okay but doesn't play. By running the Player.Open again it plays, so a timing issue? I'll have a play with batching those 3 and other ways.

Hmm, AE problem? http://pastebin.com/RUgz42kY I've removed all the addon and PVR spam.

If I batch the above three it plays without issue. Doesn't help in my case as I parse a playlist and it might be adding multiple items. Oddly enough again. If it is multiple items it plays as expected.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - roli - 2012-09-17

I have a small question about the JSON-RPC method: Player.GetActivePlayers. The question being - can you even have multiple players? I really don't get the point of this method. Basically I've never seen it return more than one player id. So I was wondering - under which circumstances will that method return more than one player?


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-09-17

For the moment only music and picture players can start at the same time Smile


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-09-17

(2012-09-17, 16:58)roli Wrote: I have a small question about the JSON-RPC method: Player.GetActivePlayers. The question being - can you even have multiple players? I really don't get the point of this method. Basically I've never seen it return more than one player id. So I was wondering - under which circumstances will that method return more than one player?

When you are listening to music and looking at a slideshow.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Millencolin007 - 2012-09-18

I discovered some time ago that it is possible to browse the xbmc library over json-rpc using the special path musicdb://. Maybe this path is not intended to be used that way...

I have seen that for the path musicdb://2/ (Artists path) the artist field is not returned as array but as string which I think should be the case since the change beginning of august. Querying other musicdb:// paths seem to return the artist field as array.

Code:
curl  -H "Content-Type: application/json"  -d "{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"Files.GetDirectory\",\"params\":{\"directory\":\"musicdb://2/\",\"media\":\"files\",\"properties\":[\"title\",\"thumbnail\",\"playcount\",\"artist\",\"album\"],\"sort\":{\"method\":\"label\",\"order\":\"ascending\"}}}" http://127.0.0.1:8080/jsonrpc



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-09-18

musicdb:// and videodb:// are internal paths but there's no code stopping you from using such paths in Files.GetDirectory. You can also use addons:// path (literally anything that xbmc's virtual filesystem supports) but you won't be able to retrieve the metadata.

Returning the "artist" field as a string makes perfect sense for musicdb://2/ because that's the same as calling AudioLibrary.GetArtists which will also return a string for "artist" and not an array because it doesn't make sense to list multiple artists as the name for a single artist.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Millencolin007 - 2012-09-18

(2012-09-18, 15:12)Montellese Wrote: musicdb:// and videodb:// are internal paths but there's no code stopping you from using such paths in Files.GetDirectory. You can also use addons:// path (literally anything that xbmc's virtual filesystem supports) but you won't be able to retrieve the metadata.

Returning the "artist" field as a string makes perfect sense for musicdb://2/ because that's the same as calling AudioLibrary.GetArtists which will also return a string for "artist" and not an array because it doesn't make sense to list multiple artists as the name for a single artist.

Ok, I see. I am just going to catch that special case in code then for the moment.

But it would be a good thing if Files.GetDirectory always returns the artist the same way. Otherwise it does not match the definition from the json schema and it prevents you to use some higher level api to parse json objects directly to java.

I already use the addons:// path in Music Pump to browse through the music and video addons but it has some issues(pops up progress dialogs on xbmc, search masks are hidden behind the progress dialog etc...) Those dialogs also make json-rpc block sometimes until the dialogs are clicked away. Far from perfect but it works