Kodi Community Forum

Full Version: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
(2013-11-20, 09:05)Montellese Wrote: [ -> ]I know the cause of the problem of the "no matching source found" but that shouldn't cause a crash.

The crash was with an OpenELEC build for 18 Nov, but another build on 19 Nov now results not in a crash but the "no matching source found", so maybe it was a duff build on 18 Nov.

If you know the cause of the "no matching source" then I'll stop investigating and I'll put it down to a one-off bad build since I didn't see the same unhandled exception with - in theory - the same xbmc code on Ubuntu.
The "no matching source found" is solved by 24ce994a311668ff6fbb2840230c24405dd6300a. The crashes you saw might be related to the recent removal of CStdString in code a few days ago which resulted in quite a few crashes but most of them have been fixed now.
(2013-11-20, 09:47)Montellese Wrote: [ -> ]The "no matching source found" is solved by 24ce994a311668ff6fbb2840230c24405dd6300a. The crashes you saw might be related to the recent removal of CStdString in code a few days ago which resulted in quite a few crashes but most of them have been fixed now.

Excellent, that seems to have fixed it in OpenELEC, GetDirectory is working again - many thanks!
Hi.

Butchabay have made some tests with my script (randomandlastitems) with Gotham and it seems that this release cannot resolve special://skin path :

http://forum.xbmc.org/showthread.php?tid...pid1508162

How to reproduce this issue (tested with Gotham 13.0-ALPHA10 Git:20131117-7f212b9) :

1 - create playlists/video/<PlaylistName>.xsp file in skin folder
2 - Try to get movie list from this playlist :

Code:
_json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "%s", "media": "video", "properties": ["title", "originaltitle", "playcount", "year", "genre", "studio", "country", "tagline", "plot", "runtime", "file", "plotoutline", "lastplayed", "trailer", "rating", "resume", "art", "streamdetails", "mpaa", "director", "dateadded"]}, "id": 1}' %(PLAYLIST))
    _json_query = unicode(_json_query, 'utf-8', errors='ignore')
    _json_pl_response = json.loads(_json_query)
    print("##### RESPONSE=",_json_pl_response)

Error in xbmc.log :

Code:
13:23:47 T:6976   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://skin/playlists/video/Parents.xsp", "media": "video", "properties": ["title", "originaltitle", "playcount", "year", "genre", "studio", "country", "tagline", "plot", "runtime", "file", "plotoutline", "lastplayed", "trailer", "rating", "resume", "art", "streamdetails", "mpaa", "director", "dateadded"]}, "id": 1}
13:23:47 T:6976   DEBUG: CUtil::GetMatchingSource: no matching source found for [special://skin/playlists/video/Parents.xsp]
13:23:47 T:6976   DEBUG: Previous line repeats 4 times.
13:23:47 T:6976  NOTICE: ('##### RESPONSE=', {u'jsonrpc': u'2.0', u'id': 1, u'error': {u'message': u'Invalid params.', u'code': -32602}})

The same playlist stored in special://profile/playlists/video/Parents.xsp is OK :

Code:
13:28:36 T:6084   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://profile/playlists/video/Parents.xsp", "media": "video", "properties": ["title", "originaltitle", "playcount", "year", "genre", "studio", "country", "tagline", "plot", "runtime", "file", "plotoutline", "lastplayed", "trailer", "rating", "resume", "art", "streamdetails", "mpaa", "director", "dateadded"]}, "id": 1}
13:28:36 T:6084   DEBUG: CVideoDatabase::RunQuery took 15 ms for 92 items query: select * from movieview  WHERE ((movieview.strPath LIKE '%Parents%'))
13:28:36 T:6084  NOTICE: ('##### RESPONSE=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'files': [{u'rating': 3.799999952316284, u'art': {u'fanart': ....................
.........

Using special://skin/playlists/video/Parents.xsp file is OK in Frodo :

Code:
13:07:21 T:3380   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://skin/playlists/video/Parents.xsp", "media": "video", "properties": ["title", "originaltitle", "playcount", "year", "genre", "studio", "country", "tagline", "plot", "runtime", "file", "plotoutline", "lastplayed", "trailer", "rating", "resume", "art", "streamdetails", "mpaa", "director", "dateadded"]}, "id": 1}
13:07:21 T:3380   DEBUG: CVideoDatabase::RunQuery took 14 ms for 92 items query: select * from movieview  WHERE ((movieview.strPath LIKE '%Parents%'))

Thanks.
Latest Gotham (24ce994a311668ff6fbb2840230c24405dd6300a) - can anyone confirm if artists are being returned for "AudioLibrary.GetAlbums"?

Eg.
Code:
{"jsonrpc": "2.0", "params": {"sort": {"order": "ascending", "method": "label"}, "filter": {"operator": "contains", "field": "album", "value": "abbey road"}, "properties": ["title", "artist", "fanart", "thumbnail"]}, "method": "AudioLibrary.GetAlbums", "id": "libAlbums"}
{"id":"libAlbums","jsonrpc":"2.0","result":{"albums":[{"albumid":25,"artist":[""],"fanart":"image://http%3a%2f%2fassets.fanart.tv%2ffanart%2fmusic%2fb10bbbfc-cf9e-42e0-be17-e2c3e1d2600d%2fartistbackground%2fthe-beatles-4ddaaf1a51231.jpg/","label":"Abbey Road","thumbnail":"image://nfs%3a%2f%2f192.168.0.3%2fmnt%2fshare%2fdata%2fMusic%2fMP3%2fBeatles%2fAbbey%20Road%2fcover.jpg/","title":"Abbey Road"}],"limits":{"end":1,"start":0,"total":1}}}

Notice how the artist field is [""], when it should be: ["The Beatles"]

It's the same without a filter too - no artitsts returned for any call to GetAlbums.
(2013-11-20, 14:36)mikebzh44 Wrote: [ -> ]Hi.

Butchabay have made some tests with my script (randomandlastitems) with Gotham and it seems that this release cannot resolve special://skin path :

http://forum.xbmc.org/showthread.php?tid...pid1508162

How to reproduce this issue (tested with Gotham 13.0-ALPHA10 Git:20131117-7f212b9) :

1 - create playlists/video/<PlaylistName>.xsp file in skin folder
2 - Try to get movie list from this playlist :

Code:
_json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "%s", "media": "video", "properties": ["title", "originaltitle", "playcount", "year", "genre", "studio", "country", "tagline", "plot", "runtime", "file", "plotoutline", "lastplayed", "trailer", "rating", "resume", "art", "streamdetails", "mpaa", "director", "dateadded"]}, "id": 1}' %(PLAYLIST))
    _json_query = unicode(_json_query, 'utf-8', errors='ignore')
    _json_pl_response = json.loads(_json_query)
    print("##### RESPONSE=",_json_pl_response)

Error in xbmc.log :

Code:
13:23:47 T:6976   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://skin/playlists/video/Parents.xsp", "media": "video", "properties": ["title", "originaltitle", "playcount", "year", "genre", "studio", "country", "tagline", "plot", "runtime", "file", "plotoutline", "lastplayed", "trailer", "rating", "resume", "art", "streamdetails", "mpaa", "director", "dateadded"]}, "id": 1}
13:23:47 T:6976   DEBUG: CUtil::GetMatchingSource: no matching source found for [special://skin/playlists/video/Parents.xsp]
13:23:47 T:6976   DEBUG: Previous line repeats 4 times.
13:23:47 T:6976  NOTICE: ('##### RESPONSE=', {u'jsonrpc': u'2.0', u'id': 1, u'error': {u'message': u'Invalid params.', u'code': -32602}})

The same playlist stored in special://profile/playlists/video/Parents.xsp is OK :

Code:
13:28:36 T:6084   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://profile/playlists/video/Parents.xsp", "media": "video", "properties": ["title", "originaltitle", "playcount", "year", "genre", "studio", "country", "tagline", "plot", "runtime", "file", "plotoutline", "lastplayed", "trailer", "rating", "resume", "art", "streamdetails", "mpaa", "director", "dateadded"]}, "id": 1}
13:28:36 T:6084   DEBUG: CVideoDatabase::RunQuery took 15 ms for 92 items query: select * from movieview  WHERE ((movieview.strPath LIKE '%Parents%'))
13:28:36 T:6084  NOTICE: ('##### RESPONSE=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'files': [{u'rating': 3.799999952316284, u'art': {u'fanart': ....................
.........

Using special://skin/playlists/video/Parents.xsp file is OK in Frodo :

Code:
13:07:21 T:3380   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://skin/playlists/video/Parents.xsp", "media": "video", "properties": ["title", "originaltitle", "playcount", "year", "genre", "studio", "country", "tagline", "plot", "runtime", "file", "plotoutline", "lastplayed", "trailer", "rating", "resume", "art", "streamdetails", "mpaa", "director", "dateadded"]}, "id": 1}
13:07:21 T:3380   DEBUG: CVideoDatabase::RunQuery took 14 ms for 92 items query: select * from movieview  WHERE ((movieview.strPath LIKE '%Parents%'))

Thanks.

Probably because of the restrictions added to Files.GetDirectory for security reasons. Will see if "special://skin" is in the list of exceptions.

(2013-11-21, 06:18)MilhouseVH Wrote: [ -> ]Latest Gotham (24ce994a311668ff6fbb2840230c24405dd6300a) - can anyone confirm if artists are being returned for "AudioLibrary.GetAlbums"?

Eg.
Code:
{"jsonrpc": "2.0", "params": {"sort": {"order": "ascending", "method": "label"}, "filter": {"operator": "contains", "field": "album", "value": "abbey road"}, "properties": ["title", "artist", "fanart", "thumbnail"]}, "method": "AudioLibrary.GetAlbums", "id": "libAlbums"}
{"id":"libAlbums","jsonrpc":"2.0","result":{"albums":[{"albumid":25,"artist":[""],"fanart":"image://http%3a%2f%2fassets.fanart.tv%2ffanart%2fmusic%2fb10bbbfc-cf9e-42e0-be17-e2c3e1d2600d%2fartistbackground%2fthe-beatles-4ddaaf1a51231.jpg/","label":"Abbey Road","thumbnail":"image://nfs%3a%2f%2f192.168.0.3%2fmnt%2fshare%2fdata%2fMusic%2fMP3%2fBeatles%2fAbbey%20Road%2fcover.jpg/","title":"Abbey Road"}],"limits":{"end":1,"start":0,"total":1}}}

Notice how the artist field is [""], when it should be: ["The Beatles"]

It's the same without a filter too - no artitsts returned for any call to GetAlbums.

Maybe one of the fallouts of the musicdb changes. Can you create a trac ticket? Thanks.
(2013-11-21, 08:53)Montellese Wrote: [ -> ]Maybe one of the fallouts of the musicdb changes. Can you create a trac ticket? Thanks.

Done - ticket #14709.
(2013-11-20, 14:36)mikebzh44 Wrote: [ -> ]Hi.

Butchabay have made some tests with my script (randomandlastitems) with Gotham and it seems that this release cannot resolve special://skin path :

http://forum.xbmc.org/showthread.php?tid...pid1508162

How to reproduce this issue (tested with Gotham 13.0-ALPHA10 Git:20131117-7f212b9) :

1 - create playlists/video/<PlaylistName>.xsp file in skin folder
2 - Try to get movie list from this playlist :

Code:
_json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "%s", "media": "video", "properties": ["title", "originaltitle", "playcount", "year", "genre", "studio", "country", "tagline", "plot", "runtime", "file", "plotoutline", "lastplayed", "trailer", "rating", "resume", "art", "streamdetails", "mpaa", "director", "dateadded"]}, "id": 1}' %(PLAYLIST))
    _json_query = unicode(_json_query, 'utf-8', errors='ignore')
    _json_pl_response = json.loads(_json_query)
    print("##### RESPONSE=",_json_pl_response)

Error in xbmc.log :

Code:
13:23:47 T:6976   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://skin/playlists/video/Parents.xsp", "media": "video", "properties": ["title", "originaltitle", "playcount", "year", "genre", "studio", "country", "tagline", "plot", "runtime", "file", "plotoutline", "lastplayed", "trailer", "rating", "resume", "art", "streamdetails", "mpaa", "director", "dateadded"]}, "id": 1}
13:23:47 T:6976   DEBUG: CUtil::GetMatchingSource: no matching source found for [special://skin/playlists/video/Parents.xsp]
13:23:47 T:6976   DEBUG: Previous line repeats 4 times.
13:23:47 T:6976  NOTICE: ('##### RESPONSE=', {u'jsonrpc': u'2.0', u'id': 1, u'error': {u'message': u'Invalid params.', u'code': -32602}})

The same playlist stored in special://profile/playlists/video/Parents.xsp is OK :

Code:
13:28:36 T:6084   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://profile/playlists/video/Parents.xsp", "media": "video", "properties": ["title", "originaltitle", "playcount", "year", "genre", "studio", "country", "tagline", "plot", "runtime", "file", "plotoutline", "lastplayed", "trailer", "rating", "resume", "art", "streamdetails", "mpaa", "director", "dateadded"]}, "id": 1}
13:28:36 T:6084   DEBUG: CVideoDatabase::RunQuery took 15 ms for 92 items query: select * from movieview  WHERE ((movieview.strPath LIKE '%Parents%'))
13:28:36 T:6084  NOTICE: ('##### RESPONSE=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'files': [{u'rating': 3.799999952316284, u'art': {u'fanart': ....................
.........

Using special://skin/playlists/video/Parents.xsp file is OK in Frodo :

Code:
13:07:21 T:3380   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://skin/playlists/video/Parents.xsp", "media": "video", "properties": ["title", "originaltitle", "playcount", "year", "genre", "studio", "country", "tagline", "plot", "runtime", "file", "plotoutline", "lastplayed", "trailer", "rating", "resume", "art", "streamdetails", "mpaa", "director", "dateadded"]}, "id": 1}
13:07:21 T:3380   DEBUG: CVideoDatabase::RunQuery took 14 ms for 92 items query: select * from movieview  WHERE ((movieview.strPath LIKE '%Parents%'))

Thanks.

Should be fixed with the latest commit.
I have made some tests with XBMC (13.0-ALPHA10 Git:20131126-32d14df). (Platform: x86 Win32 32-bit), which is the latest nightlie available at the moment.

Code:
14:49:55 T:7484   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://skin/playlists/video/Parents.xsp", "media": "video", "properties": ["title", "originaltitle", "playcount", "year", "genre", "studio", "country", "tagline", "plot", "runtime", "file", "plotoutline", "lastplayed", "trailer", "rating", "resume", "art", "streamdetails", "mpaa", "director", "dateadded"]}, "id": 1}
14:49:55 T:7484   DEBUG: Random and Last items script: [RandomAndLastItems] JSON RESULT {u'jsonrpc': u'2.0', u'id': 1, u'error': {u'message': u'Invalid params.', u'code': -32602}}

(2013-11-25, 09:38)Montellese Wrote: [ -> ]Should be fixed with the latest commit.

Does your commit is merged with 13.0-ALPHA10 Git:20131126-32d14df or do I have to wait for a new release ?

Thanks.
(2013-11-19, 14:26)Montellese Wrote: [ -> ]
(2013-11-16, 21:12)Tolriq Wrote: [ -> ]Just discovered a strange bug with JSON.

Code:
{"id":1,"jsonrpc":"2.0","method":"VideoLibrary.GetTVShows","params":{"limits":{"start":0,"end":1500},"properties":["episode","genre","rating","originaltitle","studio","year","plot","title","playcount","art","dateadded","mpaa","lastplayed","sorttitle","cast"]}}

Send back playcount field with the actual number episode watched like 92 and field episode contains the actual number of episode so need to substract the values to know the show watched status.

when sending :

Code:
{"id":1,"jsonrpc":"2.0","method":"VideoLibrary.GetTVShows","params":{"limits":{"start":0,"end":1500},"properties":["episode","genre","rating","originaltitle","studio","year","plot","title","playcount","art","dateadded","mpaa","lastplayed","sorttitle"]}}

I.E. same request without cast Smile

Then playcount is sendback as 1 or 0 depending on the actual played status of the show or not.

This is a quite inconsistent behavior leading to some troubles Smile

Thanks for the report. I tracked down the problem but will have to see how best to fix it.

EDIT: Mind creating a bug report on track for it as it's easier to keep track of those than of forum posts.

Seems this bug also affected some other fields like year that is always 0 when requesting cast.

Seems to be corrected with your commit but perhaps other things are broken too and should be checked.

And do you know a workaround for Eden / Frodo for the Year at 0 ?
The fields affected are year and playcount. They are the only ones with special handling that was different depending on whether all or just a single tvshow was retrieved from the database (requesting "cast" will force json-rpc to retrieve every tvshow separately).

The only workaround is to either not get those fields through GetTvShows (only through GetTvShowDetails) or to use something like "cast" or "streamdetails" to force the detailed retrieval (which is also a lot slower).
Well not getting the cast in the main query and doing X further queries is very very slow Sad

But I guess no choice Sad
Seems I missunderstood as the GetTvShowDetails have the same bug Smile

Only solution seems to query all in main list and then query all but cast to refresh data then just cast Sad

I wonder how this was not found since Eden Sad
Seems like an old bug have come back Smile
Code:
{"jsonrpc":"2.0","id":1,"method":"Files.GetDirectory","params":{"directory":"musicdb://years/","media":"music","properties":["title","thumbnail","fanart","rating","genre","artist","track","season","episode","year","duration","album","showtitle","playcount","file","mimetype","size","lastmodified"],"sort":{"method":"label","order":"ascending"}}}
returns
Code:
{"id":1,"jsonrpc":"2.0","result":{"files":[{"album":"","artist":[],"duration":0,"fanart":"","file":"musicdb://years/1958/","filetype":"directory","genre":[],"label":"1958","mimetype":"x-directory/normal","playcount":0,"rating":0,"size":0,"thumbnail":"","title":"","track":0,"type":"song","year":1958},{"album":"","artist":[],"duration":0,"fanart":"","file":"musicdb://years/1959/","filetype":"directory","genre":[],"label":"1959","mimetype":"x-directory/normal","playcount":0,"rating":0,"size":0,"thumbnail":"","title":"","track":0,"type":"song","year":1959},{"album":"","artist":[],"duration":0,"fanart":"","file":"musicdb://years/1961/","filetype":"directory","genre":[],"label":"1961","mimetype":"x-directory/normal","playcount":0,"rating":0,"size":0,"thumbnail":"","title":"","track":0,"type":"song","year":1961},{"album":"","artist":[],"duration":0,"fanart":"","file":"musicdb://years/1963/","filetype":"directory","genre":[],"label":"1963","mimetype":"x-directory/normal","playcount":0,"rating":0,"size":0,"thumbnail":"","title":"","track":0,"type":"song","year":1963}
The type is back from unknown to song Smile This may affect quite some cases in both video and audio library as before.
While investigating another issue with debug logging enabled, I noticed there is an addon executing the same json request every 2 seconds:
Code:
18:27:34 T:2799494224   DEBUG: JSONRPC: Incoming request: [{"id":0,"jsonrpc":"2.0","method":"Player.GetActivePlayers"},{"id":1,"jsonrpc":"2.0","method":"Application.GetProperties","params":{"properties":["volume","muted"]}}]
18:27:36 T:2871731280   DEBUG: JSONRPC: Incoming request: [{"id":0,"jsonrpc":"2.0","method":"Player.GetActivePlayers"},{"id":1,"jsonrpc":"2.0","method":"Application.GetProperties","params":{"properties":["volume","muted"]}}]
18:27:38 T:2799494224   DEBUG: JSONRPC: Incoming request: [{"id":0,"jsonrpc":"2.0","method":"Player.GetActivePlayers"},{"id":1,"jsonrpc":"2.0","method":"Application.GetProperties","params":{"properties":["volume","muted"]}}]
...

Is there any way to tell the source of these requests (although it's almost certainly localhost), or which addon it is that is going nuts? The full log is here. Surely whatever addon is generating these requests doesn't need to request them every 2 seconds for the entire time a system is up?

Edit: On a hunch, I disabled the WiFi on my Nexus 7 tablet which has Yatse installed... and the requests stopped. Will let the Yatse developer know. I'd have thought they could avoid repeated calls to GetActivePlayers/GetProperties by instead monitoring notifications (OnPlay, OnVolumeChanged etc.)