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 - Mizaki - 2013-12-14

Hey,

Just checking compatibility with Gotham. I think I read about this but can't find it now. Am I right in saying access is only allowed to directories defined as sources? The reason is I use the code below to list the language files etc.

Code:
{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params" : { "directory" : "C:\\Users\\username\\AppData\\Roaming\\XBMC\\addons\\webinterface.awxi/lang", "media" : "files", "properties": [ "file" ], "sort": { "order": "ascending", "method": "file" } }, "id": 1}

A bit screwed without this access. Ta.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Mizaki - 2013-12-22

Is this a no go at all?


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Millencolin007 - 2013-12-22

Try this path...

Code:
special://home/addons/webinterface.awxi/lang/

I think this should work


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2013-12-22

(2013-12-22, 14:44)Millencolin007 Wrote: Try this path...

Code:
special://home/addons/webinterface.awxi/lang/

I think this should work

Sounds like a much better approach to me because the example you provided only works on windows anyway and won't work on any other operating system.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Mizaki - 2013-12-22

I use

Code:
{ "method": "Addons.GetAddonDetails", "id": 0, "jsonrpc": "2.0", "params": { "addonid": "webinterface.awxi", "properties": ["path"] } }

first to get the addon path in case someone has renamed it or done anything silly etc.

Sadly still the same; debug log:
Code:
CUtil::GetMatchingSource: no matching source found for [special://home/addons/webinterface.awxi/lang/]

I could hardcode it but dynamic loading makes more sense if possible Smile


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Millencolin007 - 2013-12-22

Yes, you are right it doesn't work anymore. I was testing against 12.3 but thought it was a nightly build

Take a look at the function RemoteAccessAllowed
https://github.com/xbmc/xbmc/blob/master/xbmc/utils/FileUtils.cpp


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Regss - 2014-01-04

I'm doing this way:

Code:
102. jsonGetMovieDetails = '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"properties": ["title", "plot", "rating", "year", "thumbnail", "fanart", "runtime", "genre", "director", "originaltitle", "country", "trailer", "playcount", "lastplayed", "dateadded", "streamdetails"], "movieid": ' + id + '}, "id": "1"}'
103. jsonGetMovieDetailsResponse = json.loads(xbmc.executeJSONRPC(jsonGetMovieDetails))

and get error (stars at line 154): xbmc.log


Should I use json.dumps?


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

There are quite a few threads about this topic. JSON-RPC returns UTF-8 paths but your decoding of the string is wrong. I don't remember the solution (because I don't really know python) but I'm sure you'll be able to find the solution when searching with the error in the log.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - helloworld1 - 2014-01-08

trash


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

This folder is no more accessible from JSON.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Rizzo - 2014-01-16

(2011-06-08, 16:40)Montellese Wrote: As an FYI the "tvshowid" parameter in VideoLibrary.GetEpisodes just became optional with the latest commit. Now you can retrieve all episodes in your library if needed. But beware if you want to use the "season" parameter, you need to define the "tvshowid" parameter as well.

Will this also be implemented for VideoLibrary.GetSeasons? So that you can get a list of all the seasons.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2014-01-16

(2014-01-16, 12:43)Rizzo Wrote:
(2011-06-08, 16:40)Montellese Wrote: As an FYI the "tvshowid" parameter in VideoLibrary.GetEpisodes just became optional with the latest commit. Now you can retrieve all episodes in your library if needed. But beware if you want to use the "season" parameter, you need to define the "tvshowid" parameter as well.

Will this also be implemented for VideoLibrary.GetSeasons? So that you can get a list of all the seasons.

Not for Gotham as the current code in the videodatabase for seasons is very limited and only works for seasons of a specific tvshow.
But in a branch I'm currently working on (nothing to do with JSON-RPC though) I have actually refactored that code to be able to retrieve all seasons independent of the tvshow. So it's a possibility for a future release.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Lunatixz - 2014-01-17

(2013-11-21, 08:53)Montellese Wrote:
(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=122448&pid=1508162#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.

Has this issue been resolved? where can I find the Gotham security exceptions list? I'm currently unable to request json response from a playlist located in userdata\addon_data.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2014-01-17

(2014-01-17, 01:01)Lunatixz Wrote: Has this issue been resolved? where can I find the Gotham security exceptions list? I'm currently unable to request json response from a playlist located in userdata\addon_data.

Right now you can access any of the following paths (or it's sub-directories):
  • virtualpath://upnproot/
  • musicdb://
  • videodb://
  • library://video
  • sources://video
  • special://musicplaylists
  • special://profile/playlists
  • special://videoplaylists
  • addons://sources
  • upnp://
  • plugin://
  • all paths you have specified as a source (or as part of a source)

If there's any missing, please let me know which ones and provide an argument/use case why it's necessary.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Lunatixz - 2014-01-17

Thanks! I think userdata/addon_data needs to be added. In my case, I have a plugin that generates xsp stored in addon_data, and then want to run a query on them. addon_data folder is there for various plugin files, doesn't make sense to include addon folder without its data folder.