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)



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-03-22 16:54

I can't say but it sounds like a very specific request.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - jpcolin - 2012-03-22 19:49

Hi,

I'm not sure this is the right area to post but let me know.
I would like to know if there is or if it is possible to have the following commands:
- direct acces to subtitles menu while watching a movie
- direct acces to video settings menu while watching a movie
- an exit command to exit this menus (and other) and go back to the movie full screen

thank you


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-03-22 20:30

JSON-RPC only has a very limited set of methods that can be used for remote controlling XBMC like using a remote and directly accessing the subtitles menu or the video settings menu are not even available for normal remotes and as long as that's how it is for the rest of XBMC it will also stay that way for JSON-RPC.
Exiting menus is always possible with Input.Back.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - jpcolin - 2012-03-23 14:56

I tought you could do more with Json than what the normal remote does?
the problem with Input.Back is if you execute this command while watching a movie, the home menu shows up while the movie is still playing in background!


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-03-23 15:02

Sure you can do more than a normal remote but that's also why JSON-RPC provides almost no methods in the area of remote controling as that can already be done with normal remotes. JSON-RPC provides access to XBMC's libraries etc. So it might be better to specify what exactly you want to do and maybe it is possible to add methods to do what you want without having to navigate to the specific dialog/window in XBMC's GUI.

Why do you need access to the subtitles menu anyway? JSON-RPC provides ways to retrieve all the subtitles available for the currently playing video and it also has methods to change/enable/disable the subtitle.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - jpcolin - 2012-03-23 17:11

so i'm not wrong by saying you guys can add control/acces to specific menus with Json commands?
i know this command to enable/disable subs:
{"jsonrpc": "2.0", "method": "Player.SetSubtitle", "params": {"playerid": 1, "subtitle" : "on"}, "id": "1"}
{"jsonrpc": "2.0", "method": "Player.SetSubtitle", "params": {"playerid": 1, "subtitle" : "off"}, "id": "1"}

but i use the subtitles add on, so would to have a command to have direct access to this add on to download the subs in the right language.
not sure my request is clear?
and also another specific command to exit any menu while watching a movie or listening to music, (like the "ESC" on a windows machine.)


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-03-23 17:32

Well in general it would be possible to allow access to specific dialogs etc but that doesn't mean that it will be supported. The JSON-RPC API should be as clean as possible to keep it as stable as possible. Furthermore your request concerning the subtitles addon is on a whole different level because it does not have to do with a dialog from XBMC core but from an addon so it's not even certain whether the addon is installed or not. The JSON-RPC API won't provide methods to access an addon-specific feature because those methods wouldn't work if the addon isn't installed. Furthermore addon integration may vary depending on the skin you use.

What is planned concerning addons is to someday allow them to expose their own JSON-RPC methods which could be used by clients if the addon is installed.

I also looked into the behaviour of Input.Back that you described and I can't reproduce that. I started playing a movie, got to the OSD and then opened several different dialogs (video settings, audio settings, subtitle addon, ...) and then sent an Input.Back request to JSON-RPC and it always closed the dialog and went back to the fullscreen video (with OSD) so I'm not sure what you're problem there is. Maybe it's a skin related thing. I tested both with Confluence and Aeon Nox.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - jpcolin - 2012-03-23 18:49

I uderstant the problem of the add on, but i would also be happy with a json command to openthe sbutitles dialog (where i can choose a files fir the subs and set the offset...)
have you tried to sent the Input.Back request while watching a movie (without any dialog or menu open) just when watching the movie?


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-03-23 19:16

(2012-03-23 18:49)jpcolin Wrote:  I uderstant the problem of the add on, but i would also be happy with a json command to openthe sbutitles dialog (where i can choose a files fir the subs and set the offset...)
Apparently you don't understand the problem. The problem is that the subtitle download dialog is an addon and it is not always installed/available and not integrated into every skin so therefore there won't be any direct access to it through JSON-RPC.

(2012-03-23 18:49)jpcolin Wrote:  have you tried to sent the Input.Back request while watching a movie (without any dialog or menu open) just when watching the movie?
Obviously then it goes back to the previous menu that was open before starting the movie/video. Input.Back should behave exactly the same as the ESC key. But your initial question/request was "an exit command to exit this menus (and other) and go back to the movie full screen" and I tested it and it works perfectly fine using "Input.Back" as I already suggested earlier (and you said it wouldn't work).


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - jpcolin - 2012-03-23 19:21

yes i understant the problem with the add on, i was in my last message talking about the standard xbmc subtitle menu.

ok i wil try again.

thank you


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-03-27 17:53

Forgot to post this update from sunday

Sunday, March 25th 2012:
Commit: 4d4eac0b4043c99d9794
Add support for WebSockets. Websockets are accessible using the port of the TCP server (by default 9090) and using version 8 (draft) or 13 (final) of the websocket specification. So the URL to access the websocket would be e.g.
Code:
ws://localhost:9090/jsonrpc
For now websockets are only available for JSON-RPC and support the same features as the TCP Server (i.e. notifications but no file download).


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-03-27 18:47

And here comes the first (rather big) update for JSON-RPC API v5:

Tuesday, March 27th 2012:
Commit: 32b3b77f9829202e1528
  • added Input.ContextMenu and Input.Info
  • added System.EjectOpticalDrive and a new permission ControlSystem
  • added GUI namespace with the methods ShowNotification, SetFullscreen and GetProperties (current properties are "currentwindow", "currentcontrol", "fullscreen" and "skin")
  • added AudioLibrary.GetRecentlyPlayedAlbums and AudioLibrary.GetRecentlyPlayedSongs
  • added properties "size", "lastmodified" and "mimetype" to Files.GetDirectory
  • added properties "season" and "watchedepisodes" to VideoLibrary.GetTvShows and "watchedepisodes" to VideoLibrary.GetSeasons
  • added notification Application.OnVolumeChanged
  • extended Application.SetVolume to support "increment" and "decrement"
  • added optional "play" parameter to Player.PlayPause
  • added optional "enable" parameter to Player.SetSubtitle
  • added optional "directory" parameter to (Audio|Video)Library.Scan
  • added optional "options" parameter to Player.Open which can have the properties "shuffled", "repeat" and "resume"
  • improved properties returned by Player.GetItem for non-library media being played
  • added sort methods "country", "dateadded", "listeners" and "bitrate"



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Mizaki - 2012-03-27 19:45

Nice.

Will any of these additions (plus future ones) make it into an 11.x release? I can imagine a lot of these being very useful and it'll be a shame to have to wait a year or so before using them.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-03-27 19:57

(2012-03-27 19:45)Mizaki Wrote:  Nice.

Will any of these additions (plus future ones) make it into an 11.x release? I can imagine a lot of these being very useful and it'll be a shame to have to wait a year or so before using them.

No they won't any 11.x releases (if there will be any at all) will only contain bugfixes, no new features and especially no API changes. But we are planning to release the next version ealier than in a year.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-03-27 21:01

I just pushed a major refactor of how the webserver works internally. Currently this has only one effect on how it works and that affects JSON-RPC clients using JSON-RPC over HTTP. You need to make sure you set the Content-Type in the HTTP header to "application/json" and not something like "multipart/form-data" because that is plain wrong. The new implementation has the functionality to parse POST data for certain content-types (including application/json and multipart/form-data) and will therefore fail if the content-type does not match the actual POST data.