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 - codex70 - 2012-12-03

Now that I can't send a keypress is there any way to activate the epg view from json?

Was using: GET /xbmcCmds/xbmcHttp?command=SendKey(0xF045) which behind the scenes does: XBMC.ActivateWindowAndFocus(MyPVR, 31,0, 10,0)

How would I do this from a json command, and ideally then set another command so I can return to full screen whatever is currently playing.

It looks like I should be using GUI.ActivateWindow, but can't find anything more so any help would be appreciated.


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

Yeah you need to call (untested)
Code:
{ "jsonrpc": "2.0", "method": "GUI.ActivateWindow", "params": { "window": "pvr", "parameters": [ 32, 0, 10, 0 ] }, "id": 1 }

Ideally the EPG view would be its own window (AFAIK someone is working on that) so you could open it directly but that's not possible right now.

To get to fullscreen call
Code:
{ "jsonrpc": "2.0", "method": "GUI.SetFullscreen", "params": { "fullscreen": true }, "id": 1 }



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - codex70 - 2012-12-03

Thanks Montellese for such a quick response,

I'm getting the following error back:
{"error":{"code":-32602,"data":{"method":"GUI.ActivateWindow","stack":{"message":"array element at index 0 does not match","name":"parameters","property":{"message":"Invalid type integer received","type":"string"},"type":"array"}},"message":"Invalid params."},"id":1,"jsonrpc":"2.0"}

Which is king of suggesting the array elements aren't OK. Am I close here, or is this really unsupported and I'm going to have to wait till post frodo?


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

(2012-12-03, 10:52)Montellese Wrote: I don't develop any client but what I don't like about this approach is that it probably results in a flickering of the keyboard being presented because it's most likely hidden when the OnInputFinished is received and then immediatelly shown again when the OnInputRequested is received. An idea would be to use this behaviour but to add an additional parameter to the notifications letting clients know whether the input is a virtual keyboard dialog (in which case the user of the client will most likely want to see the keyboard on the client as well) or not (in which case the user might not want to see the keyboard on the client as he may just be navigating around and had to go through an edit control).

Another approach might be to not send an OnInputRequested/OnInputFinished notification when going from an edit control to the virtual keyboard dialog. That way the client will be able to show the virtual keyboard from the moment the edit control is focused, throughout the time where the virtual keyboard dialog is opened and closed until the user leaves the edit control. The problem with this approach is, is that the "done" parameter of Input.SendText becomes a bit unintuitive as focus will still be on the edit control.

This is the moment I choose to discretely ask again for a new flag in Application.Property.Value to get the status Smile


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

(2012-12-03, 16:37)codex70 Wrote: Thanks Montellese for such a quick response,

I'm getting the following error back:
{"error":{"code":-32602,"data":{"method":"GUI.ActivateWindow","stack":{"message":"array element at index 0 does not match","name":"parameters","property":{"message":"Invalid type integer received","type":"string"},"type":"array"}},"message":"Invalid params."},"id":1,"jsonrpc":"2.0"}

Which is king of suggesting the array elements aren't OK. Am I close here, or is this really unsupported and I'm going to have to wait till post frodo?
Ah silly me. All the array elements in the "parameters" array must be strings so you'll have to put double-quotes around those values.

(2012-12-03, 16:48)Tolriq Wrote: This is the moment I choose to discretely ask again for a new flag in Application.Property.Value to get the status Smile
Which status?


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

To know if there's a input request occurring (I.E. if we should send key presses or keymap commands) for case when we don't get the notification.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - codex70 - 2012-12-03

That's more or less working, it's not properly using the values in the array, it's going to the last PVR view, but it's close enough and works.

One last question (for now) is there any way to switch profiles with json. I've been searching and can't see anything that would work.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - claymic - 2012-12-03

I have a little problem using VideoLibrary.set., when i use this to set the playcount of a file, after that i get a error trying to get the streamdetails of this file. See the code:
Quote:self.rpc("VideoLibrary.SetMovieDetails", { "movieid": movieid, "playcount": 0}, self.logReplyData);
then i request the streamdetails and i get this error:
Quote:> Exception caught while processing response in xbmc.rpc: TypeError: 'undefined' is not an object (evaluating 'streamdetails.video[0].aspect')
After set the playcount to 0 i loose the streamdetail video for acpect ratio.
Thanks for any help
Clayton
Well, i maked some more tests, i loose every single streamdetail, everytime i tried to get this i get a error, only happens after set the playcount;


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - claymic - 2012-12-03

Another test
This is the streamdetails after i used VideoLibrary.SetMovieDetails for playcount = 0
Quote:> audio: {
}
subtitle: {
}
video: {
}



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

(2012-12-03, 17:05)Tolriq Wrote: To know if there's a input request occurring (I.E. if we should send key presses or keymap commands) for case when we don't get the notification.

But only a flag is not enough, you also want to know the current text in the control if a control or virtual keyboard is currently present. Otherwise you'll bluntly override any text that's already there, which is not very user friendly.


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

(2012-12-03, 19:28)gertjanzwartjes Wrote:
(2012-12-03, 17:05)Tolriq Wrote: To know if there's a input request occurring (I.E. if we should send key presses or keymap commands) for case when we don't get the notification.

But only a flag is not enough, you also want to know the current text in the control if a control or virtual keyboard is currently present. Otherwise you'll bluntly override any text that's already there, which is not very user friendly.

Actually Tolriq has a good point; when I think about it, what if you have opened a virtual keyboard with a simple remote, say a normal remote cotrol, or you're Apple remote, whatever one that doesn't have a keyboard. Then you grab your remote app which does have a keyboard, to edit the text in the virtual keyboard you just opened. So you connect to XBMC, and try to edit the text and all the text in there will be erased at the first call of SendText, because you didn't get an OnInputRequested because the virtual keyboard was already open. Or do you?


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - claymic - 2012-12-03

(2012-12-03, 19:26)claymic Wrote: Another test
This is the streamdetails after i used VideoLibrary.SetMovieDetails for playcount = 0
Quote:> audio: {
}
subtitle: {
}
video: {
}

I found the problem. When i use VideoLibrary.SetMovieDetails for playcount = 0 this take at least 7 seconds for each movie, if i make any call before this time i get a error in the streamdetails.
So, this is normal ? Take 7 or 12 seconds to set the playcount for each movie ? I am using the Frodo Beta 1.
Thanks
Clayton


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

(2012-12-03, 19:44)gertjanzwartjes Wrote:
(2012-12-03, 19:28)gertjanzwartjes Wrote:
(2012-12-03, 17:05)Tolriq Wrote: To know if there's a input request occurring (I.E. if we should send key presses or keymap commands) for case when we don't get the notification.

But only a flag is not enough, you also want to know the current text in the control if a control or virtual keyboard is currently present. Otherwise you'll bluntly override any text that's already there, which is not very user friendly.

Actually Tolriq has a good point; when I think about it, what if you have opened a virtual keyboard with a simple remote, say a normal remote cotrol, or you're Apple remote, whatever one that doesn't have a keyboard. Then you grab your remote app which does have a keyboard, to edit the text in the virtual keyboard you just opened. So you connect to XBMC, and try to edit the text and all the text in there will be erased at the first call of SendText, because you didn't get an OnInputRequested because the virtual keyboard was already open. Or do you?
Yeah it's a valid use case but too late in the release cycle to add new methods etc. Additionally sending out an existing notifications does not affect the API so that wouldn't be such a big deal.

(2012-12-03, 22:29)claymic Wrote:
(2012-12-03, 19:26)claymic Wrote: Another test
This is the streamdetails after i used VideoLibrary.SetMovieDetails for playcount = 0
Quote:> audio: {
}
subtitle: {
}
video: {
}

I found the problem. When i use VideoLibrary.SetMovieDetails for playcount = 0 this take at least 7 seconds for each movie, if i make any call before this time i get a error in the streamdetails.
So, this is normal ? Take 7 or 12 seconds to set the playcount for each movie ? I am using the Frodo Beta 1.
Thanks
Clayton

Hm I just ran 3 VideoLibrary.SetMovieDetails calls and they were instant. I could switch to the sqlite browser, hit refresh and the changes were there.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - claymic - 2012-12-04

Ok, i maked some more tests and will try to explain in my bad english, i am sorry for that.
- Situation 1 : if i am in the window HOME (xbmc) and tried to set the playcount to 0 or 1 (using my app for ipad), take between 7 or 10 seconds and i lose all the streamdetails for the movie.
- Situation 2: if i am in the window MOVIE(xbmc) and tried to set the playcount to 0 or 1 (using my app for ipad), take between 2 or 3 seconds and i dont lose the streamdetails for the movie.
- Situation 3: after lose the streamdetails in situation 1, i cant get the streamdetails for this movie anymore if i am in the window HOME, but if i go to the window MOVIE and maked another request i get all the streamdetails again.
I dont know if i explain right, i am sorry for that.
Clayton


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

Are you playing a movie while doing this? And how are you retrieving the streamdetails? Through VideoLibrary.GetMovies or VideoLibrary.GetMovieDetails?