XBMC Community Forum
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Development (/forumdisplay.php?fid=93)
+---- Forum: JSON-RPC (/forumdisplay.php?fid=174)
+---- Thread: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC (/showthread.php?tid=68263)



- Tolriq - 2012-02-09 19:12

With basic i mean a little more than arrows Smile

Like context menu, go to home / video or such screens / info .... the actions that are mappable in keymaps.


Player.Repeat - doozer - 2012-02-10 04:10

Any chance Eden can be updated to send an unsolicited message when the user changes the "Repeat" setting (off/one/all) ?

Noticed in Eden Beta 3, changing this setting doesn't result in a Player.Repeat update being broadcast.

Thanks,
Matt.


Genre issue - doozer - 2012-02-10 08:53

Hi All,

Hoping an expert can weigh in here and tell me if i'm doing something wrong..

I am listing all Genres:
Code:
{"jsonrpc": "2.0", "method": "AudioLibrary.GetGenres", "params": {"properties": ["title"], "limits": { "start" : 0, "end" : 20 }, "sort": { "method" : "label", "order" : "ascending" }}, "id": "AudioLibrary.GetGenres"}

Which results in:
Code:
{"id":"AudioLibrary.GetGenres","jsonrpc":"2.0","result":{"genres":[{"genreid":6,"label":"Alternative","title":"Alternative"},{"genreid":2,"label":"Hip-Hop","title":"Hip-Hop"},{"genreid":5,"label":"Punk","title":"Punk"},{"genreid":4,"label":"Rock","title":"Rock"},{"genreid":3,"label":"Unknown","title":"Unknown"}],"limits":{"end":5,"start":0,"total":5}}}

Note that the "Alternative" genre has an ID of 6.
I then request all Albums that fit this genre:
Code:
{"jsonrpc": "2.0", "method": "AudioLibrary.GetAlbums", "params": {"genreid": 6,"properties": ["artist","artistid","albumlabel","year","thumbnail","genre"], "limits": { "start" : 0, "end" : 20 }, "sort": { "method" : "label", "order" : "ascending" }}, "id": "AudioLibrary.GetAlbumsByGenre"}

And get:
Code:
{"id":"AudioLibrary.GetAlbumsByGenre","jsonrpc":"2.0","result":{"albums":[{"albumid":9,"albumlabel":"WEA","artist":"Green Day","artistid":7,"genre":"Punk","label":"Dookie","thumbnail":"special://masterprofile/Thumbnails/Music/d/daca1175.tbn","year":1994},{"albumid":12,"albumlabel":"Reprise","artist":"Green Day","artistid":7,"genre":"Alternative","label":"Warning","thumbnail":"special://masterprofile/Thumbnails/Music/2/29036724.tbn","year":2000}],"limits":{"end":2,"start":0,"total":2}}}

Notice how I get one album of genre "Punk" and one of "Alternative". Why?


- Montellese - 2012-02-10 11:06

doozer Wrote:Any chance Eden can be updated to send an unsolicited message when the user changes the "Repeat" setting (off/one/all) ?

Noticed in Eden Beta 3, changing this setting doesn't result in a Player.Repeat update being broadcast.
Same goes for shuffle and other settings. But I'm not gonna add any new stuff to the JSON-RPC API for Eden at this point in the release cycle. Please create a feature request ticket for it on trac so I won't forget once Eden is out.

doozer Wrote:Hi All,

Hoping an expert can weigh in here and tell me if i'm doing something wrong..

I am listing all Genres:
Code:
{"jsonrpc": "2.0", "method": "AudioLibrary.GetGenres", "params": {"properties": ["title"], "limits": { "start" : 0, "end" : 20 }, "sort": { "method" : "label", "order" : "ascending" }}, "id": "AudioLibrary.GetGenres"}

Which results in:
Code:
{"id":"AudioLibrary.GetGenres","jsonrpc":"2.0","result":{"genres":[{"genreid":6,"label":"Alternative","title":"Alternative"},{"genreid":2,"label":"Hip-Hop","title":"Hip-Hop"},{"genreid":5,"label":"Punk","title":"Punk"},{"genreid":4,"label":"Rock","title":"Rock"},{"genreid":3,"label":"Unknown","title":"Unknown"}],"limits":{"end":5,"start":0,"total":5}}}

Note that the "Alternative" genre has an ID of 6.
I then request all Albums that fit this genre:
Code:
{"jsonrpc": "2.0", "method": "AudioLibrary.GetAlbums", "params": {"genreid": 6,"properties": ["artist","artistid","albumlabel","year","thumbnail","genre"], "limits": { "start" : 0, "end" : 20 }, "sort": { "method" : "label", "order" : "ascending" }}, "id": "AudioLibrary.GetAlbumsByGenre"}

And get:
Code:
{"id":"AudioLibrary.GetAlbumsByGenre","jsonrpc":"2.0","result":{"albums":[{"albumid":9,"albumlabel":"WEA","artist":"Green Day","artistid":7,"genre":"Punk","label":"Dookie","thumbnail":"special://masterprofile/Thumbnails/Music/d/daca1175.tbn","year":1994},{"albumid":12,"albumlabel":"Reprise","artist":"Green Day","artistid":7,"genre":"Alternative","label":"Warning","thumbnail":"special://masterprofile/Thumbnails/Music/2/29036724.tbn","year":2000}],"limits":{"end":2,"start":0,"total":2}}}

Notice how I get one album of genre "Punk" and one of "Alternative". Why?

I was confused at first as well but in general XBMC always operates on songs when using the audiolibrary so what it does when you retrieve all albums of a certain genre is it actually returns all albums which contain at least one song with that genre. So in you're case there should be at least one song in Green Day's Dookie album which has "Alternative" as a genre.


- doozer - 2012-02-11 09:04

Montellese Wrote:Same goes for shuffle and other settings. But I'm not gonna add any new stuff to the JSON-RPC API for Eden at this point in the release cycle. Please create a feature request ticket for it on trac so I won't forget once Eden is out.

I was confused at first as well but in general XBMC always operates on songs when using the audiolibrary so what it does when you retrieve all albums of a certain genre is it actually returns all albums which contain at least one song with that genre. So in you're case there should be at least one song in Green Day's Dookie album which has "Alternative" as a genre.

Will do.

Ah, I see, it's on a per song basis, not a per album. Makes sense. Thanks.


- mikebzh44 - 2012-02-11 18:19

I'm using Files.GetDirectory for getting movies of a playlist :
Code:
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://profile/playlists/video/cartoons.xsp", "media": "video", "properties": ["originaltitle"], "sort": { "order": "descending", "method": "date" }}, "id": 1}')
I'm using sort to get last added movies but it doesn't seem to work because movies are returned in alphabetical order :
Code:
{u'jsonrpc': u'2.0',
u'id': 1,
u'result': {u'files': [{u'filetype': u'file', u'label': u"Winter's Bone", u'originaltitle': u"Winter's Bone", u'file': u'smb://READYNAS/media/Videos/HD/Films/Winter s bone/Winter s bone.mkv', u'type': u'movie', u'id': 75},
                        {u'filetype': u'file', u'label': u'Usual Suspects', u'originaltitle': u'The Usual Suspects', u'file': u'smb://READYNAS/media/Videos/HD/Films/The Usual Suspects/The Usual Suspects.mkv', u'type': u'movie', u'id': 70},
                        {u'filetype': u'file', u'label': u'Twilight - Chapitre 4 : R\xe9v\xe9lation 1\xe8re partie', u'originaltitle': u'Breaking Dawn - Part 1', u'file': u'smb://READYNAS/media/Videos/HD/Films/Twilight/Twilight - Chapitre 4 - Revelation 1ere partie/Twilight - Chapitre 4 - Revelation 1ere partie.m2ts', u'type': u'movie', u'id': 74},
                        {u'filetype': u'file', u'label': u'Twilight - Chapitre 3 : h\xe9sitation', u'originaltitle': u'Eclipse', u'file': u'smb://READYNAS/media/Videos/HD/Films/Twilight/Twilight - Chapitre 3 - Hesitation/Twilight III.mkv', u'type': u'movie', u'id': 73}
                       ],
             u'limits': {u'start': 0, u'total': 4, u'end': 4}
            }
}

How can I get movies from a playlist sorted by date ?


- Montellese - 2012-02-11 18:24

The sort method "date" does not mean the date the movie was added to the database. Those sort methods are a mess and very confusing (sorry for that) :-S

There's currently no way to automatically sort by date added. It was added to XBMC before the feature freeze but I didn't know about it and therefore it didn't make it into the JSON-RPC API for Eden. I'm not gonna change the API at this time anymore for Eden. But it will be available after Eden.


- mikebzh44 - 2012-02-11 18:33

I was confused because before today, request seems to bo OK but today, I have completly rebuild my video data so every movies was added today.

I will see tomorrow, when I will add some new movies, what the request will return.


- mikebzh44 - 2012-02-11 21:24

When I am using VideoLibrary.GetRecentlyAddedMovies, I get only 25 movies but if I use VideoLibrary.GetMovies, I get 187 movies.

GetRecentlyAddedMovies is limited ?


- Montellese - 2012-02-11 21:55

Yes as the name suggests by containing "Recently" Wink