JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC

  Thread Rating:
  • 8 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
topfs2 Offline
Team-XBMC Developer
Posts: 4,004
Joined: Dec 2007
Reputation: 10
Information  JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC
Post: #1
Hi, I just wanted to inform those that develop supplimental tools and client that there will be a new integration option into xbmc soon.

The main benefits with the new wrapper will be:
  • transport independant, meaning that it could go over http, tcp socket, udp socket, bluetooth socket or pipe designwise (only the first two will be available at the beginning)
  • Standardised output. All data will be produced in json which is a very light, easy to use and perfect abstraction of objects
  • Standardised protocol. jsonrpc have been around for quite some time so there should exist plenty of wrappers for easy useage in your favourite language.
  • Transport specific transfer. The transfer is handled by the transport meaning that no longer will you have to base64 decode the data from http.
  • Wrapping. Everything is wrapped, the base idea is that nothing will utilise xbmc methods. i.e. there will be no xbmc.executebuiltin which can do a zillion things instead every operation will be done in the correct namespace. (executebuiltin(playercontrol(play)) is now MusicPlayer.PlayPause)
  • Security. Much like android security is built in on a per client/application basis, so one client may be allowed to control playback whilst another may be allowed to manipulate the library. For now most of the clients will probably be allowed it all, to ease the transition but at some point there will probably be GUI interaction so the user can approve and disapprove the client.

The method structure will use the following schema "Namespace.Method" so a namespace will be logically names and the method applicable to that namespace alone. examples:
  • Player.GetActivePlayers
  • MusicPlayer.PlayPause
  • XBMC.Quit
  • System.Shutdown

Anyways I just wanted to bring the client creators up to speed on this as its starting to get somewhat finished, and before its final I would like to get some input about what you guys would like to use it to and whats missing. So we can get as good final product as possible.

Here is the currently mapped methods, there are still alot of info getters left and I'll add them as soon as I fix some other parts of the xbmc code needed. The first column says methodcall, the second is internal the third states transport specific need. the forth client permission need and finally the fifth is a description about the method.

Cheers,
Tobias

If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
slash Offline
Fan
Posts: 577
Joined: Sep 2007
Reputation: 6
Post: #2
Hi,

This is a nice initiative. As a tool developer (XBMX Web Media Manager) here are some suggestions :

For the movie database:
- get actor, movieactors and tvshowactors
- get genres

General:
- getshares to return also the usb disks (now it doesn't)
- get the thumbs and fanart name for a specific file (so client doesn't have to calculate the CRCs)
- Do you think it would be possible to do a selective get (exple: getmovies where value = something) ?

Thanks
find quote
topfs2 Offline
Team-XBMC Developer
Posts: 4,004
Joined: Dec 2007
Reputation: 10
Post: #3
Yeah the get shares should really list usb disks, have forgotten to add that. will see if I can add that.

Get Actors and get genres are good ideas, will add it.

Also the introspect doesn't really show the params, might be worth adding though.

The getmovies takes param, so you can do MovieLibrary.GetMovies were genreid = X.
Same with songs, MusicLibrary.GetSongs(artistid=Y)

When you get stuff it will always return thumbnail if it exists, fanart I haven't added, shall see if I can add it.

Thanks for the suggestions.
Cheers,
Tobias

If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
slash Offline
Fan
Posts: 577
Joined: Sep 2007
Reputation: 6
Post: #4
Great,

Looking forward to test this.

Thanks for your work and efforts.
Cheers
Nick
find quote
CrashX Offline
Posting Freak
Posts: 1,164
Joined: Jan 2009
Reputation: 2
Post: #5
Would be nice to see a way to access/set the following via web interface:

1) Keymaps
2) AdvancedSettings

The normal XBMC log IS NOT a debug log, to enable debug logging you must toggle it on under XBMC Settings - System or in advancedsettings.xml. Use XBMC Debug Log Addon to retrieve it.
find quote
topfs2 Offline
Team-XBMC Developer
Posts: 4,004
Joined: Dec 2007
Reputation: 10
Post: #6
Advanced settings is planned, will probably have to wait until version 2 though since it needs some alterations in advancedsettings handling.

Keymaps, I'd rather alter how input works and make a context driven input system and add mapping in gui (like games).

If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
CrashX Offline
Posting Freak
Posts: 1,164
Joined: Jan 2009
Reputation: 2
Post: #7
Awesome news.

How about some more video options:
1) Zoom
2) Info

Wouldn't it be better to send a keypress to the gui via web interface instead adding commands one at a time ? or better yet send the Keypress Actions themselves ? That way you have to access all XBMC commands.

The normal XBMC log IS NOT a debug log, to enable debug logging you must toggle it on under XBMC Settings - System or in advancedsettings.xml. Use XBMC Debug Log Addon to retrieve it.
(This post was last modified: 2010-01-28 23:32 by CrashX.)
find quote
topfs2 Offline
Team-XBMC Developer
Posts: 4,004
Joined: Dec 2007
Reputation: 10
Post: #8
CrashX Wrote:Awesome news.

How about some more video options:
1) Zoom
2) Info

Wouldn't it be better to send a keypress to the gui via web interface instead adding commands one at a time ? or better yet send the Keypress Actions themselves ? That way you have to access all XBMC commands.

Well a key can be mapped, an action cannot. they serve different functions. Allthough I've thought of adding Key sending aswell so that it could work as eventserver aswell, but I need to alter stuff inside xbmc first.

And making all actions one at a time is tiresome but it adds security, since each action has its own security, so you can't call system.powerdown but call musicplayer.play from your iPhone if this is how you want it.

EDIT: Info and zoom I'll add, didn't think of them, thx

If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
CrashX Offline
Posting Freak
Posts: 1,164
Joined: Jan 2009
Reputation: 2
Post: #9
topfs2 Wrote:And making all actions one at a time is tiresome but it adds security, since each action has its own security, so you can't call system.powerdown but call musicplayer.play from your iPhone if this is how you want it.

True but we do have web authenication right ? What is differences in executing the action by pressing a key vs over the web ?

Another way is to maintain list of Admin only commands ( should be very short list ) ... ie system.powerdown and then have a gui settting that says allow admin command via web.

The normal XBMC log IS NOT a debug log, to enable debug logging you must toggle it on under XBMC Settings - System or in advancedsettings.xml. Use XBMC Debug Log Addon to retrieve it.
(This post was last modified: 2010-01-28 23:50 by CrashX.)
find quote
topfs2 Offline
Team-XBMC Developer
Posts: 4,004
Joined: Dec 2007
Reputation: 10
Post: #10
Pressing a key gets translated into an action depending on the window your currently in, so space can mean multiple things.

An action is _always_ the same, no matter what the context or window it is.

Yes, we have web authentication but if you have authenticated a script that is said to download subtitles, how do you know it won't delete all your files, delete your library and shutdown your system?

I'd say that for the web it makes less sense since you probably know the client, but since were aiming at perhaps add this for script aswell its much less transparent what will happen when you start it.

Check android, it has the same security model. http://developer.android.com/guide/topic...urity.html

This means that when you start an app or client we can pop up a dialog stating that this script asks for permission to alter your library, if it tries to do anything else it will be denied.

If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
sijones Offline
Junior Member
Posts: 28
Joined: Jan 2005
Reputation: 0
Post: #11
definition, codecs that sort of thing..
find quote
spiff Offline
Retired Developer
Posts: 12,386
Joined: Nov 2003
Post: #12
uhm, those are obviously avail as props on the getxxx calls.
find quote
CrashX Offline
Posting Freak
Posts: 1,164
Joined: Jan 2009
Reputation: 2
Post: #13
topfs2 Wrote:Pressing a key gets translated into an action depending on the window your currently in, so space can mean multiple things.

An action is _always_ the same, no matter what the context or window it is.

I am sorry you misunderstood me, I was asking what the differences in security was between executing the action using keyboard instead of web for XBMC ?

To me, it looks like xbmc web interface is something designed to be used for local network instead of over the internet. The web scripts that we would run are those that are development by XBMC developers. My use of web interface is as a replacement for mouse/keyboard, ie XBMCRemote.

The normal XBMC log IS NOT a debug log, to enable debug logging you must toggle it on under XBMC Settings - System or in advancedsettings.xml. Use XBMC Debug Log Addon to retrieve it.
(This post was last modified: 2010-01-29 16:29 by CrashX.)
find quote
topfs2 Offline
Team-XBMC Developer
Posts: 4,004
Joined: Dec 2007
Reputation: 10
Post: #14
CrashX Wrote:I am sorry you misunderstood me, I was asking what the differences in security was between executing the action using keyboard instead of web for XBMC ?

To me, it looks like xbmc web interface is something designed to be used for local network instead of over the internet. The web scripts that we would run are those that are development by XBMC developers. My use of web interface is as a replacement for mouse/keyboard, ie XBMCRemote.

No difference.

The security is applied per client, so if the client is allowed to execute keypresses it will be allowed so, then it will be same as keyboard. Although jsonrpc doesn't wrap keypresses yet, it will at some point I hope though.

Also which might get lost in the translation is that the webinterface is actually also a client.

If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
slash Offline
Fan
Posts: 577
Joined: Sep 2007
Reputation: 6
Post: #15
Hi,

The list is very impressive. Nice work.

Will the HTTP API database operations like queryvideodatabase, execvideodatabase, querymuscidatabase and execmusicdatabase still be available ?
find quote
Post Reply