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 - Tolriq - 2012-08-28

A small remark about introspect :

Code:
"List.Limits": {
    "type": "object",
    "properties": {
      "start": { "type": "integer", "minimum": 0, "default": 0 },
      "end": { "type": "integer", "minimum": 0, "default": -1, "description": "The number of items in the list being returned" }
    },
    "additionalProperties": false
  },

After not understanding why my code did not work it seems end is really the end and not the number of items we want Smile it perhaps needs a little update of this description.

Edit : And having a default to -1 to mean all but need a value of 0 to mean all from client side is a little disturbing.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - seadog - 2012-08-28

I'm using the JSON api to update the play counts of movies/tv episodes (I'm updating the trakt utilities script to work with frodo) and even sending multliple setmoviedetails at a time is still really slow, is there a better way to send them to speed it up, or is this operation just inherently slow?


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

Another small remark Smile

Shouldn't the streamdetails field return an empty array instead of null to keep consistency when not available ?
This is the only field that can return the null value instead of an empty one of the correct type needing adding more case handling in json streaming parsing.


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

And an annoying bug with GetArtists, the total field is not correctly filed it's value is set to end.
So no way to know the number or artists.

Seems from code that it misses a few lines :

Code:
HandleFileItemList("artistid", false, "artists", items, param, result, false);

should be
Code:
int size = items.Size();
  if (items.HasProperty("total") && items.GetProperty("total").asInteger() > size)
    size = (int)items.GetProperty("total").asInteger();
  HandleFileItemList("artistid", true, "artists", items, parameterObject, result, size, false);

And even if I don't use limits on GetGenre from code too I suppose limits are not applied to them.


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

Hi guys, been searching around but can't seem to find the solution. How do I get the actual names of all the playlists? I have 3 saved audio playlists i.e. Playlist 1, Playlist 2 and Playlist 3

Used
Code:
{"jsonrpc":"2.0","method":"Playlist.GetPlaylists","params":{},"id":1}
but only returns
Code:
{"id":1,"jsonrpc":"2.0","result":[{"playlistid":0,"type":"audio"},{"playlistid":1,"type":"video"},{"playlistid":2,"type":"picture"}]}

Used
Code:
{"jsonrpc":"2.0","method":"Playlist.GetProperties","params":{"playlistid":0,"properties":["size","type"]},"id":1}
but only returns
Code:
{"id":1,"jsonrpc":"2.0","result":{"size":20,"type":"audio"}}

Seems like I'm missing some properties or I'm using the wrong methods to get the playlists' labels.


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

(2012-08-30, 06:20)terrylau Wrote: Hi guys, been searching around but can't seem to find the solution. How do I get the actual names of all the playlists? I have 3 saved audio playlists i.e. Playlist 1, Playlist 2 and Playlist 3

Used
Code:
{"jsonrpc":"2.0","method":"Playlist.GetPlaylists","params":{},"id":1}
but only returns
Code:
{"id":1,"jsonrpc":"2.0","result":[{"playlistid":0,"type":"audio"},{"playlistid":1,"type":"video"},{"playlistid":2,"type":"picture"}]}

Used
Code:
{"jsonrpc":"2.0","method":"Playlist.GetProperties","params":{"playlistid":0,"properties":["size","type"]},"id":1}
but only returns
Code:
{"id":1,"jsonrpc":"2.0","result":{"size":20,"type":"audio"}}

Seems like I'm missing some properties or I'm using the wrong methods to get the playlists' labels.

There is no specific json method to retrieve the playlists. The functions are for the "play queue" and not for playlists in xsp or m3u format. But you can get the playlists using Files.GetDirectory:
Code:
curl -d "{\"jsonrpc\": \"2.0\", \"method\": \"Files.GetDirectory\", \"params\" : { \"directory\" : \"special://musicplaylists\" }, \"id\" : 1 }" http://10.0.0.127:8080/jsonrpc

Then you can use Files.GetDirectory on the returned items to get the content of the playlists



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

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?


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - yallah - 2012-08-31

Hi,

Is it possible to have feedback for available audio track movies. Want send JSON command, and parse which audio channel available for movies



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

@Mizaki : the only thing I think of is that year is int so should not have the "" .

@yallah: just request for the properties "streamdetails" in VideoLibrary.GetMovies, there's plenty of sample for the GetMovies in this thread Smile


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

Is a Playlist.Move function in the plans ?

Because from what I understand currently we need to do a remove / insert, and while remove is easy, insert needs analysis of previous getItems to then send the correct insert statement depending on the media since we can't just send back the full item.

Or perhaps I missed something ?


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - yallah - 2012-08-31

(2012-08-31, 10:14)Tolriq Wrote: @yallah: just request for the properties "streamdetails" in VideoLibrary.GetMovies, there's plenty of sample for the GetMovies in this thread Smile

Oh Thx


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - yallah - 2012-08-31

last question... Smile

why when I send Json for album, some have good extension (.jpg) for thumbnail and other have thubnail with extension .mp3. Just want know if prob come from scraper or json ?

Thx

Exemple :

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"albums": [
{
"albumid": 1,
"artist": [
"Akon"
],
"fanart": "image://http%3a%2f%2ffanart.tv%2ffanart%2fmusic%2f1138a764-2212-4d0a-b02d-0dc14df91e08%2fartistbackground%2f25199%2fakon-4f74ad8903235.jpg",
"label": "In My Ghetto",
"thumbnail": "image://http%3a%2f%2fuserserve-ak.last.fm%2fserve%2f300x300%2f26039299.jpg",
"title": "In My Ghetto"
},
{
"albumid": 2,
"artist": [
"Akon"
],
"fanart": "image://http%3a%2f%2ffanart.tv%2ffanart%2fmusic%2f1138a764-2212-4d0a-b02d-0dc14df91e08%2fartistbackground%2f25199%2fakon-4f74ad8903235.jpg",
"label": "In My Ghetto [Vol 02]",
"thumbnail": "image://music@smb%3a%2f%2fDISKSTATION%2fmusic%2fAkon%20-%20Discography%205%20Albums%2fAkon%20-%20In%20My%20Ghetto%20%5bVol%2002%5d%20%5b2008%5d%2f01%20%20Akon%20-%20Still%20Runnin%20%5bFeat.%20Tupac%5d.mp3",
"title": "In My Ghetto [Vol 02]"
}
],
"limits": {
"end": 2,
"start": 0,
"total": 2
}
}
}


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - grywnn - 2012-08-31

(2012-08-31, 13:01)Tolriq Wrote: Is a Playlist.Move function in the plans ?

Because from what I understand currently we need to do a remove / insert, and while remove is easy, insert needs analysis of previous getItems to then send the correct insert statement depending on the media since we can't just send back the full item.

Or perhaps I missed something ?

I ran into the same problem, solved this by doing multiple swaps - for moving an item from position 3 to position 6 for example i swap 3 and 4, then 4 and 5, then 5 and 6.
But a Playlist.Move woud be highly appreciated Smile


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

@yallah : this is normal with last json, you don't have to check the extension returned, you will still get a valid image in png format.

@grywnn : I finally found an easier way Smile I insert a dummy item at the to position from the file of from item so that always work, then I swap the good from item with the dummy item then I delete the dummy item. That way no problem of multiple swaps. (Of course the to position needs adjustment from > to is different than from < to).

But I must also admit that a notification of playlist changed would be cool because those multiple changes makes keeping sync hard to follow in case of problems.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - yallah - 2012-08-31

(2012-08-31, 15:13)Tolriq Wrote: @yallah : this is normal with last json, you don't have to check the extension returned, you will still get a valid image in png format.

thx for your reply,

But if I want thumbnails, I must replace .mp3 or had .png ?

thumbnail": "image://music@smb%3a%2f%2fDISKSTATION%2fmusic%2fAkon%20-%20Discography%205%20Albums%2fAkon%20-%20In%20My%20Ghetto%20%5bVol%2002%5d%20%5b2008%5d%2f01%20%20Akon%20-%20Still%20Runnin%20%5bFeat.%20Tupac%5d.mp3"