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 - frostering - 2016-07-07

Hi,

I'm having an ugly little problem with the server responses using websocket.

I'm using a websocket connection to communicate to Kodi server, but I cannot handle the responses depending on what they are responding for. I was able to implement a workaround to handle the requests synchronously, but it's not a gentle solution and it doesn't work perfect. I can't relay on the server response to parse the received data because I don't know what server it's responding for.

For example, if I send a request to the server by using the api method "Application.GetProperties", I can receive the response to that call. But I can receive any other response (like a notification for OnStop, for example) between that method call and its response.

It would be perfect that the Kodi server includes in the response what method is responding for. If you invoke the "Application.GetProperties" method, the server response will include a param with: "method":"Application.GetProperties". I wonder why this was not contemplated when websocket connection were added.

Of course using HTTP there is no problem at all, because of the connection protocol. This problem occurs only when using a websocket connection.

Thank you all!


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2016-07-07

(2016-07-07, 19:49)frostering Wrote: Hi,

I'm having an ugly little problem with the server responses using websocket.

I'm using a websocket connection to communicate to Kodi server, but I cannot handle the responses depending on what they are responding for. I was able to implement a workaround to handle the requests synchronously, but it's not a gentle solution and it doesn't work perfect. I can't relay on the server response to parse the received data because I don't know what server it's responding for.

For example, if I send a request to the server by using the api method "Application.GetProperties", I can receive the response to that call. But I can receive any other response (like a notification for OnStop, for example) between that method call and its response.

It would be perfect that the Kodi server includes in the response what method is responding for. If you invoke the "Application.GetProperties" method, the server response will include a param with: "method":"Application.GetProperties". I wonder why this was not contemplated when websocket connection were added.

Of course using HTTP there is no problem at all, because of the connection protocol. This problem occurs only when using a websocket connection.

Thank you all!

That's what the "id" property is for. Returning the requested method isn't bullet proof because you could send multiple requests to the same method before receiving a response. Just put a unique ID into every request and then you can easily match the response to the request you made. Notifications like Player.OnStop do not contain any "id" property.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - frostering - 2016-07-07

(2016-07-07, 20:00)Montellese Wrote: That's what the "id" property is for. Returning the requested method isn't bullet proof because you could send multiple requests to the same method before receiving a response. Just put a unique ID into every request and then you can easily match the response to the request you made. Notifications like Player.OnStop do not contain any "id" property.

Oh, I missed that param... Perfect, problem solved. Thank you¡


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - BasJaspers - 2016-07-11

Is there a way to limit or filter the data returned or video cast information?

I send the following JSON command to get movie details:
{"jsonrpc":"2.0","method":"VideoLibrary.GetMovieDetails","params":{"movieid":38,"properties":["title","genre","year","rating","director","plot","thumbnail","cast"]},"id":55}

All informations is returned correctly but the cast information is very long. The cast information includes:
Name
Order
Role
Thumbnail

Because I will am not going to show the cast thumbnails within my GUI it would be helpful not to receive this information. Is there a way to filter this and if so, how?
I am still learning how to use the JSON and I am getting better in it, but it is a pretty steep learning curve.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2016-07-11

(2016-07-11, 12:53)BasJaspers Wrote: Is there a way to limit or filter the data returned or video cast information?

I send the following JSON command to get movie details:
{"jsonrpc":"2.0","method":"VideoLibrary.GetMovieDetails","params":{"movieid":38,"properties":["title","genre","year","rating","director","plot","thumbnail","cast"]},"id":55}

All informations is returned correctly but the cast information is very long. The cast information includes:
Name
Order
Role
Thumbnail

Because I will am not going to show the cast thumbnails within my GUI it would be helpful not to receive this information. Is there a way to filter this and if so, how?
I am still learning how to use the JSON and I am getting better in it, but it is a pretty steep learning curve.

Unfortunately this is not supported. You can only filter the "main" properties like you're already doing.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Wimpie - 2016-07-23

Is there a way to set / get chapter / bookmark info (chapter number / time / picture / ...)?

Can't seem to find it...

Thanks!


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - BasJaspers - 2016-07-28

Is there a way to get the audio languages and subtitles that are available for a movieID. I can get the information while playing the movie, but not before.

Code:
{"jsonrpc":"2.0","method":"Player.GetProperties","params":{"playerid":1,"properties":["subtitles","audiostreams"]},"id":122}



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Milhouse - 2016-07-28

(2016-07-28, 15:33)BasJaspers Wrote: Is there a way to get the audio languages and subtitles that are available for a movieID. I can get the information while playing the movie, but not before.

Code:
{"jsonrpc":"2.0","method":"Player.GetProperties","params":{"playerid":1,"properties":["subtitles","audiostreams"]},"id":122}
No, this needs to be in an NFO (so that stream details are added to the library during scanning) or the stream details will be added to the library only when the item is first played.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Martijn - 2016-07-28

(2016-07-28, 15:33)BasJaspers Wrote: Is there a way to get the audio languages and subtitles that are available for a movieID. I can get the information while playing the movie, but not before.

Code:
{"jsonrpc":"2.0","method":"Player.GetProperties","params":{"playerid":1,"properties":["subtitles","audiostreams"]},"id":122}

(2016-07-28, 18:21)Milhouse Wrote:
(2016-07-28, 15:33)BasJaspers Wrote: Is there a way to get the audio languages and subtitles that are available for a movieID. I can get the information while playing the movie, but not before.

Code:
{"jsonrpc":"2.0","method":"Player.GetProperties","params":{"playerid":1,"properties":["subtitles","audiostreams"]},"id":122}
No, this needs to be in an NFO (so that stream details are added to the library during scanning) or the stream details will be added to the library only when the item is first played.

Depends what type of file. If it's an ISO you'll need to play it at least once. For any other file going to the Kodi library view triggers a background scan to get this data from the files. Best would be that some one adds a lazy loading trigger that once update library it done it will also trigger the background scan.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - BasJaspers - 2016-07-29

The data is save in NFO files, but how can i access those?


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Milhouse - 2016-07-29

(2016-07-29, 13:09)BasJaspers Wrote: The data is save in NFO files, but how can i access those?

You access the NFO files using a scraper. Set the content on a folder then scrape (scan) your library. Assuming the content of the NFO files is valid then it will be loaded for each movie/tvshow/episode. If the NFO file includes a <streamdetails> tag with relevant information then you should have video codec, audio codec and possibly subtitle information added to the library automatically.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - BasJaspers - 2016-07-29

I will give it a test next week. Tank you for your help.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - thedroid - 2016-09-03

-removed-


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - BasJaspers - 2016-10-10

I am trying to make a two way remote with photo viewer. I can show the pictures on my remote and can see the directories.
I am using "GUI.ActivateWindow" to navigate into a directory to search for the picture files.

{"jsonrpc":"2.0","method":"GUI.ActivateWindow","params":{"window":"pictures","parameters":["smb://Server/Pictures/"]},"id":254}

The problem is when I go deeper into subdirectory that I am not able to go back with the GUI.ActivateWindow command.
So when I am in the following folder:

{"jsonrpc":"2.0","method":"GUI.ActivateWindow","params":{"window":"pictures","parameters":["smb://Server/Pictures/Folder 1"]},"id":254}

I am not able to navigate back to the root of Pictures by calling the command:

{"jsonrpc":"2.0","method":"GUI.ActivateWindow","params":{"window":"pictures","parameters":["smb://Server/Pictures/"]},"id":254}

Am I doing something wrong? Or is this a limitation of Kodi?
I could use the back button function but if a user navigates back by using a D-pad I do not know in which directory I am because there is no current directory command.

Could someone help me out with this "problem". Thank you.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - BasJaspers - 2016-10-13

Nobody who ever had the above problem en came up with an fix?