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)



- Montellese - 2011-01-10

litemotiv Wrote:I can't seem to get it working, what would be the sortmethod parameters for retrieving the album or artists lists, ordered by name/title? Do they use the database fields, or something else?

You can see all the possible values of "sortmethod" in the following source file: https://github.com/xbmc/xbmc/blob/master/xbmc/lib/libjsonrpc/FileItemHandler.cpp

Scroll down to the function called "CFileItemHandler:TonguearseSortMethods" and you will see a whole list of possible values.


- topfs2 - 2011-01-10

litemotiv Wrote:I can't seem to get it working, what would be the sortmethod parameters for retrieving the album or artists lists, ordered by name/title? Do they use the database fields, or something else?

I've tried stuff like this:
Code:
{"jsonrpc":"2.0","method":"AudioLibrary.GetAlbums","id":1,"params":{"sortmethod":"strAlbum","start":0,"end":10}}

It is "sort": { "method": "foo", "order": "ascending" }


- litemotiv - 2011-01-10

-- not necessary anymore --


- litemotiv - 2011-01-10

topfs2 Wrote:It is "sort": { "method": "foo", "order": "ascending" }

Excellent, that works.

Now the only thing i'm seeing is that there is a problem combining sort with limit. Sorting on "album" gives back the right list, but when i add start:0 and end:10, it gets the original first 10 (based on id), and then sorts them. It should be the other way around, first sort, then limit.

Am i right?


- topfs2 - 2011-01-10

litemotiv Wrote:Excellent, that works.

Now the only thing i'm seeing is that there is a problem combining sort with limit. Sorting on "album" gives back the right list, but when i add start:0 and end:10, it gets the original first 10 (based on id), and then sorts them. It should be the other way around, first sort, then limit.

Am i right?

It does sort then limit.


- litemotiv - 2011-01-10

topfs2 Wrote:It does sort then limit.

When i do this:
Code:
{"jsonrpc":"2.0","method":"AudioLibrary.GetAlbums","id":1,"params":{"sort":{"method":"album"},"start":0,"end":10}}

I get this:
Code:
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "albums" : [
         {
            "albumid" : 7,
            "fanart" : "special://masterprofile/Thumbnails/Music/Fanart/4d1d15ff.tbn",
            "label" : "Cut the Midrange Drop the Bass (CAT 121 CD)"
         },
         {
            "albumid" : 40,
            "fanart" : "special://masterprofile/Thumbnails/Music/Fanart/94296ea4.tbn",
            "label" : "Exit planet dust",
            "thumbnail" : "special://masterprofile/Thumbnails/Music/5/56d76bca.tbn"
         }

    etc...


When i do this:
Code:
{"jsonrpc":"2.0","method":"AudioLibrary.GetAlbums","id":1,"params":{"sort":{"method":"album"}}}

I get this:
Code:
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "albums" : [
         {
            "albumid" : 3369,
            "fanart" : "special://masterprofile/Thumbnails/Music/Fanart/eea8a7f7.tbn",
            "label" : "( )"
         },
         {
            "albumid" : 2214,
            "fanart" : "special://masterprofile/Thumbnails/Music/Fanart/57bde086.tbn",
            "label" : "(Back To Basics)",
            "thumbnail" : "special://masterprofile/Thumbnails/Music/0/0942db1e.tbn"
         }

etc...



- topfs2 - 2011-01-10

Try and add order ascending also

EDIT: NVM, should not affect. Not sure what to tell you, the code states it is sort and limit. I need to verify this at some point but it should work


- ndeshmukh - 2011-01-10

Is it possible to write a script addon so that in its settings page it lets you select a script for each event in xbmc. Basically to register callbacks. That way reliance on eventghost to do certain things can also be removed. Is there a way for addons to know of events?

May be possible to have a callbacks.xml file like advancedsettings.xml to register script callbacks for events?


- litemotiv - 2011-01-10

topfs2 Wrote:Try and add order ascending also

EDIT: NVM, should not affect. Not sure what to tell you, the code states it is sort and limit. I need to verify this at some point but it should work

Ok, it would be great if someone can verify that this works.

If you have any information or questions about the crash with AudioPlaylist.GetItems, please let me know.


- Montellese - 2011-01-10

I also noticed some unexpected results when using "sort" or "start" and "end". I'll look into this and try to debug the code and maybe I can come up with an explanation.


- topfs2 - 2011-01-10

ndeshmukh Wrote:Is it possible to write a script addon so that in its settings page it lets you select a script for each event in xbmc. Basically to register callbacks. That way reliance on eventghost to do certain things can also be removed. Is there a way for addons to know of events?

May be possible to have a callbacks.xml file like advancedsettings.xml to register script callbacks for events?

Throught jsonrpc you can register on many events, check jsonrpc.introspect for the correct registration. Python have its own event mechanism which might be superseeded by jsonrpc if we decide to unify it.


Display single picture - sunny-hd - 2011-01-11

Hi,

I read through the posts trying to find a command to display a single picture stored on my NAS.

Starting a Slideshow of a directory works fine.

Code:
{"jsonrpc": "2.0", "method": "XBMC.StartSlideshow","params": { "directory": "/Volumes/Pictures/2008_Afrika/" }, "id": 1}

To show a a specific picture out of that directory I tried.

Code:
{"jsonrpc": "2.0", "method": "XBMC.Play", "params": { "file": "/Volumes/Pictures/2008_Afrika/103-0311.JPG" }, "id": 1}

Code:
{"jsonrpc": "2.0", "method": "XBMC.StartSlideshow","params": { "directory": "/Volumes/Pictures/2008_Afrika/103-0311.JPG" }, "id": 1}

How do I display a single Picture?

Thanks
Klaus


- Hiram - 2011-01-12

Hi guys, just wondering if there's a way to get the video sources via JSON-RPC? As in, get the directory path containing movies, one containing TV shows etc?

I suspect there's not, but I thought I'd double check as I greatly need something like this.

Edit: Found it myself! Fantastic. For any who find seek this information, it's Files.GetSources.


- litemotiv - 2011-01-13

litemotiv Wrote:If you have any information or questions about the crash with AudioPlaylist.GetItems, please let me know.

No crashes with the git version, so i assume it's something weird in -release. Also nice to see that GetGenres works in dev, so all is good. Smile

Now to sort out this sorting issue, time for more testing.


Rather remove System.GetInfoBooleans than fix bug ?? - vaton4 - 2011-01-13

topfs2 Wrote:Comment to ticket #11044: JSON-RPC command 'System.GetInfoBooleans' does not work properly (by topfs2):

I think I'd rather remove System.GetInfoBooleans than fix that. It really is a hack and should probably be considered as such. Any objections against that?

OK, you are the boss, but then you should add "isRandom" to Audio/VideoPlaylist.GetInfo return else nobody will be able to determine whether playlist is shuffled or not. If Shuffle/Unshuffle commands exist, there should be some way to get feedback, as randomizing playlist can be done trough other controls (infrared, for example) so using local status flag is unreliable.

Strange that "paused" and "playing" values are returned by several commands while "IsRandom" - and other flags as well - are available just by System.GetInfoBooleans. Until you delete it....