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 - Montellese - 2012-09-03

Monday, September 3rd 2012:
Commits: f41b3c5728581ce32c99, 0548adfccfc548e43c97
  • add Files.GetFileDetails
  • advanced filtering in AudioLibrary and VideoLibrary methods based on smartplaylist rules/filters



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

(2012-08-30, 23:49)Mizaki Wrote: Can anyone point out where I've gone wrong with:
Code:
{ "filter":
    {
    "or":
        [
            { "and":
                [
                    { "and":
                        [
                            {"field": "title", "operator": "startswith", "value": "v"},
                            {"field": "title", "operator": "endswith", "value": "d"}
                        ]
                    },
                    { "or":
                        [
                            {"field": "genre", "operator": "is", "value": "drama"},
                            {"field": "genre", "operator": "is", "value": "comedy"}
                        ]
                    }
                ]
            },
            {"field": "year", "operator": "is", "value": "2011"}
        ]
    }
}
Trying to do ((starts with v and endswith d) and (genre is drama or comedy)) or (year is 2011). I'm thinking of not allowing this amount of complexity but then I think if it's possible, why not? Is anyone else looking to integrate this new filter into their app atm?

Ignore this, it works. I was so busy looking at the nested structure I didn't notice I had "filter": { twice Undecided

Great work on the "advanced" filtering Smile Even if I still can't find an easy way to generate the right structure.


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

I was testing Music Pump on a raspberry pi and have discovered that some queries are very very slow. As example

Code:
time curl  -H "Content-Type: application/json"  -d "{\"jsonrpc\": \"2.0\", \"method\": \"AudioLibrary.GetSongs\", \"params\" :  {\"properties\" : [\"title\", \"artist\", \"genre\", \"album\", \"track\", \"thumbnail\", \"file\", \"duration\", \"rating\", \"albumid\", \"artistid\", \"albumartist\"] }, \"id\" : 1 }" http://192.168.1.35:8080/jsonrpc | python -mjson.tool

takes 24 minutes!! to return the json result (~10'000 songs).

If I don't fetch the thumbnail property the same query "only" takes about 1 minute to execute which is more than 20 times faster.

Code:
time curl  -H "Content-Type: application/json"  -d "{\"jsonrpc\": \"2.0\", \"method\": \"AudioLibrary.GetSongs\", \"params\" :  {\"properties\" : [\"title\", \"artist\", \"genre\", \"album\", \"track\", \"file\", \"duration\", \"rating\", \"albumid\", \"artistid\", \"albumartist\"] }, \"id\" : 1 }" http://192.168.1.35:8080/jsonrpc | python -mjson.tool

Any idea what the problem could be?



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

On rpi anything that interacts with the filesystem (db queries if you use sqlite, thumbnail caching etc) takes very long for a single filesystem access/read and if xbmc has to do that ~10'000 times it takes forever Confused


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

Does xbmc check if the thumbnails exist before returning the json response? I was thinking that the thumbnail paths are stored in the db. This would explain the huge difference between the two queries.


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

Query database does file system access to get the thumbs ?

In the case of rpi, passing from 1mn to 20mn just to get another field from db does not seems normal.

I've seen the same problem on my install during tests, if during migration from eden to frodo alpha I refuse to rescan the thumbs then all requests are way more slow.


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

Eden 11.0

Is there a way via JSON-RPC to bring up the context menu (ie. right click on an item)?

I couldn't find anything obvious, so I tried to use the old deprecated Web API as a last resort:

Code:
http://xbmc:8080/xbmcCmds/xbmcHttp?command=Action(117)

This brings up the context menu, but seems to hang XBMC until you close the context menu, which means i can't send it any navigation commands Sad

Thanks,
Matt.



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

(2012-09-06, 12:55)doozer Wrote: Eden 11.0

Is there a way via JSON-RPC to bring up the context menu (ie. right click on an item)?

I couldn't find anything obvious, so I tried to use the old deprecated Web API as a last resort:

Code:
http://xbmc:8080/xbmcCmds/xbmcHttp?command=Action(117)

This brings up the context menu, but seems to hang XBMC until you close the context menu, which means i can't send it any navigation commands Sad

Thanks,
Matt.

Unfortunately not. In the current nightly builds you can use Input.ContextMenu (or Input.ExecuteAction with the action being "contextmenu").


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

(2012-09-06, 12:55)doozer Wrote: Eden 11.0

Is there a way via JSON-RPC to bring up the context menu (ie. right click on an item)?

I couldn't find anything obvious, so I tried to use the old deprecated Web API as a last resort:

Code:
http://xbmc:8080/xbmcCmds/xbmcHttp?command=Action(117)

This brings up the context menu, but seems to hang XBMC until you close the context menu, which means i can't send it any navigation commands Sad

Thanks,
Matt.

I found the only way to do it in Eden without locking up was:

Code:
http://xbmc:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=Action(ContextMenu)

But as said above, the nightlies allow for Context Menu to be accessed directly via the Input command.

Jasp


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

Is there a way via JSON-RPC to directly play the whole music album? So far my workaround is to get all the items in the album and insert it into the playlist one by one.


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

(2012-09-07, 05:14)terrylau Wrote: Is there a way via JSON-RPC to directly play the whole music album? So far my workaround is to get all the items in the album and insert it into the playlist one by one.

It's ok, I've already found the answer by - using Playlist.Add by albumid and start playing the first item on the playlist.



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

Well the normal way would be to use the Player.Open with the albumid value of the item parameter set to the correct albumid Smile


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

You are right Smile It works now, previously tried it out but was not working and tried to do it using another way. However still having problem with using the Player.Open with the item parameter set to file :
Code:
{"jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "file": "special://profile/playlists/music/All Angels Playlist.m3u" } }, "id": 1}
gives an OK response but got just a blank black screen on the XBMC.

Looking into the xbmc.log it gives the log : ERROR: Texture manager unable to load file: special://profile/playlists/music/All Angels Playlist.m3u.

Tried with two different XBMC machines and both giving the same log and result.


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

AFAIK you can't pass a path to a playlist to the "file" parameter of Player.Open. That's only meant to be used for playable items like mp3's, avi's, mkv's etc.


Re: RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Bram77 - 2012-09-07

(2012-09-07, 05:14)terrylau Wrote: Is there a way via JSON-RPC to directly play the whole music album? So far my workaround is to get all the items in the album and insert it into the playlist one by one.

You can add all directory content (non recursive) to the playlist in one call.