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 - gertjanzwartjes - 2012-07-23 22:09

(2012-07-23 21:19)Montellese Wrote:  There seems to be an issue with JSON-RPC and OSX but I have no clue what the problem is. I can only test on win32 and linux and at least on win32 JSON-RPC requests are faster in Frodo than they are in Eden. Haven't done any comparisons on linux. Furthermore there's no platform specific code in JSON-RPC so the only place where the problem could be located is the webserver. Will have to find someone on the team to help me debug this on OSX.

If there's anything I can do to help with, let me know. I haven't set up my Mac with everything to build XBMC, if it's just doing a git checkout and typing make, I'm willing to dig around a little bit as well. I've looked at XBMC source code before, but not at the webserver.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - RobertMe - 2012-07-25 08:40

I have a question about the library ids. These ids (Library.Id) are those unique or are they only unique per type? So could there be an id = 1, type = movie and an id = 1, type = episode?

Btw: thank you for adding the OnInputRequested et all notifications, really appreciated Smile


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - dwagner - 2012-07-25 08:56

(2012-07-25 08:40)RobertMe Wrote:  I have a question about the library ids. These ids (Library.Id) are those unique or are they only unique per type? So could there be an id = 1, type = movie and an id = 1, type = episode?
You can have an id=1 for a movie and an id=1 for a tvshow episode (this would be the first movie and episode scanned into your XBMC). These ids are specific to the database table in which the items are stored i.e. the ids are only unique within their own table. So each movie will be unique amongst all movies, and each episode will be unique amongst all episodes.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - gertjanzwartjes - 2012-07-28 23:12

I continued some testing with pre-Frodo builds and I also found that Player.GetProperties for the music player is returning incorrect values for the "totaltime" attribute. I tested with the 07/27 build from yesterday for OS X. For example, for a song that's around 3 minutes or so, I get:

Code:
{
    hours = 52;
    milliseconds = 0;
    minutes = 30;
    seconds = 0;
}

Is this a know issue?

Edit: also, Player.Seek isn't working. I quickly checked for video (a TV show) and both total time and seeking is working fine.

Thanks


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-07-29 00:05

I guess this is still fallout from the AudioEngine merge. There are also missing Player notifications. Please create a bug ticket for the "totaltime" attribute and Player.Seek respectively. Thanks.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - gertjanzwartjes - 2012-07-30 12:20

(2012-07-29 00:05)Montellese Wrote:  I guess this is still fallout from the AudioEngine merge. There are also missing Player notifications. Please create a bug ticket for the "totaltime" attribute and Player.Seek respectively. Thanks.

I created ticket #13214 and #13215.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-08-02 00:11

Hey here,

Is there a way to play content with external players from JSON ? Like when choosing the open with context menu ?

If not should I create a FR for this ? Like a System.GetExternalPlayers and a new option for Player.Open ?


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

There's no way to do this. I'd have to look into how (external) players work but a FR on my github issue page certainly won't hurt.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - tanzirc - 2012-08-02 11:08

Hi there,

I am trying to retrieve Movie information with JSON RPC using the following command:

Code:
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"movieid": %d, "properties": ["title", "studio", "mpaa", "plot", "genre", "year", "runtime", "streamdetails", "rating", "tagline", "director", "writer", "fanart", "thumbnail", "file", "trailer"]}, "id": 1}' % ( self.ID, ) )

I get all the information except "streamdetails", which just returns an empty string. I have looked at the SQL database "myvideosxx.db" to check whether the stream details were extracted during the library scan, and found that they do exist in the "streamdetails" table. However the JSON call of "streamdetails" still returns an empty string.

I am using the latest nightly build (Pre-Frodo) on mac os x lion.

Am I doing anything wrong in the JSON call? Please help!

Thanks,
tanzirc


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-08-02 11:33

(2012-08-02 00:15)Montellese Wrote:  There's no way to do this. I'd have to look into how (external) players work but a FR on my github issue page certainly won't hurt.

Thanks FR done.

Another quick question but from looking at current code, it's still SendKey to use Keymap and SendText to fill dialogs ?
There's no wrapper function that auto choose to send to dialogs only when they are shown ?

Since the notifications about dialog beeing open may not be received by end use software if he takes the remote only to send texts.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-08-02 11:41

(2012-08-02 11:08)tanzirc Wrote:  Hi there,

I am trying to retrieve Movie information with JSON RPC using the following command:

Code:
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"movieid": %d, "properties": ["title", "studio", "mpaa", "plot", "genre", "year", "runtime", "streamdetails", "rating", "tagline", "director", "writer", "fanart", "thumbnail", "file", "trailer"]}, "id": 1}' % ( self.ID, ) )

I get all the information except "streamdetails", which just returns an empty string. I have looked at the SQL database "myvideosxx.db" to check whether the stream details were extracted during the library scan, and found that they do exist in the "streamdetails" table. However the JSON call of "streamdetails" still returns an empty string.

I am using the latest nightly build (Pre-Frodo) on mac os x lion.

Am I doing anything wrong in the JSON call? Please help!

Thanks,
tanzirc
I introduced this bug a few weeks ago when I did some optimizations to the number of SQL queries we run all the time. There's already a PR addressing this issue and it will be fixed ASAP.

(2012-08-02 11:33)Tolriq Wrote:  Another quick question but from looking at current code, it's still SendKey to use Keymap and SendText to fill dialogs ?
There's no wrapper function that auto choose to send to dialogs only when they are shown ?

Since the notifications about dialog beeing open may not be received by end use software if he takes the remote only to send texts.

Uhm there's no SendKey. There's only SendText (to fill dialogs and input boxes) and ExecuteAction to execute specific actions (the same actions that can be mapped to any key in a keymap.xml).


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-08-02 12:02

Hum that right Tongue I've just check the code not what is exported Smile

Is it possible that you open SendKey to remotes ? The main need is that often users have custom keymaps so showing user a keyboard for them to use their commands is way easier than making a complex interface for them to add actions and the correct values.

Same for SendText, being able to send keys directly permits text typing as you go with backspace to correct errors, this also permit direct keyboard to screen and not adding an edittext in the middle.

I must admit that keeping the SendText as it is and opening SendKey to remote with an auto switch from keymap to fill dialog would be perfect and fill all the needs for remotes.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - tanzirc - 2012-08-02 12:25

Thanks, Montellese.

Another quick question: Is there any way to get "actorID" for a specific actor from the table "actors" using a JSON call, like I could do with an SQL query using "WHERE srtActor=" in the query?

In fact, in the "VideoLibrary.GetMovieDetails" method, if I call for "cast" it just returns cast name, cast role, and cast thumb, but not actorID, which I need to activate the directory of movies by that actor using ActivateWindow(Videos,videodb://1/4/actorID).

Thanks,
tanzirc


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-08-02 13:25

(2012-08-02 12:02)Tolriq Wrote:  Hum that right Tongue I've just check the code not what is exported Smile

Is it possible that you open SendKey to remotes ? The main need is that often users have custom keymaps so showing user a keyboard for them to use their commands is way easier than making a complex interface for them to add actions and the correct values.

Same for SendText, being able to send keys directly permits text typing as you go with backspace to correct errors, this also permit direct keyboard to screen and not adding an edittext in the middle.

I must admit that keeping the SendText as it is and opening SendKey to remote with an auto switch from keymap to fill dialog would be perfect and fill all the needs for remotes.

In my initial PR which added SendText and ExecuteAction I first had an implementation of SendKey instead of SendText but jmarshall and others said that we don't want a generic SendKey because it would be very likely to be abused by remote clients to e.g. send "O" for the player OSD but it might not work for all users because of custom keymaps. If you want a user configurable remote then provide them with buttons that trigger actions instead of a keyboard. Actions are much easier to understand and remember than keys and are safer to use because they work the same for every XBMC installation independent of any keymap or something else.

(2012-08-02 12:25)tanzirc Wrote:  Thanks, Montellese.

Another quick question: Is there any way to get "actorID" for a specific actor from the table "actors" using a JSON call, like I could do with an SQL query using "WHERE srtActor=" in the query?

In fact, in the "VideoLibrary.GetMovieDetails" method, if I call for "cast" it just returns cast name, cast role, and cast thumb, but not actorID, which I need to activate the directory of movies by that actor using ActivateWindow(Videos,videodb://1/4/actorID).

Thanks,
tanzirc

No there's no support yet for actor id's etc.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-08-02 13:48

(2012-08-02 13:25)Montellese Wrote:  In my initial PR which added SendText and ExecuteAction I first had an implementation of SendKey instead of SendText but jmarshall and others said that we don't want a generic SendKey because it would be very likely to be abused by remote clients to e.g. send "O" for the player OSD but it might not work for all users because of custom keymaps. If you want a user configurable remote then provide them with buttons that trigger actions instead of a keyboard. Actions are much easier to understand and remember than keys and are safer to use because they work the same for every XBMC installation independent of any keymap or something else.

I'm sorry but I must disagree on this one.
Users sets keymaps and use them afterwards so each user know perfectly what key does what action they do on his installation.

I do agree that remote makers for show OSD or known commands must use the send action. But for advanced user (those same that to use personal keymaps) showing a keyboard for direct access to what they choose to do is much more logical.

A user that is tell to copy a custom keymap for a specific addon will do that but don't really understand what he do.
Giving the user a very complex interface so that he type the command like : Addon.OpenSettings(script.xbmc.boblight) (don't even know if it does work in current implementation).
And I don't talk about the complexity of developing such interface to present a beautiful interface for end user.

And of course you loose the use of physical phone keyboard (This one is also true for the SendText that can't do direct keyboard to dialog with backspace support).
This is more work for user to start a dialog to put a text send it. Then realize there's an error, and retype it completely. (Yes I can let the old text for next try but then if it's a new dialog the user have a manual action to clear text).

All this leaves EventServer the only way to go loosing this ability would be a real loose of functionality for remote makers and end users. (And since there's still the unicode problem with EventServer it would be really cool to either correct EventServer or add the same functionality in JSON).