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 - Tolriq - 2012-08-20

(2012-08-20, 21:09)Montellese Wrote:
(2012-08-20, 20:51)Tolriq Wrote: Is there a way to get .strm files in Files.GetDirectory with media set to video ?

It seems that they don't list even if the strm are scraped in Xbmc database.
.strm is in the list of video extensions so they should be listed by Files.GetDirectory when "media" is set to "video".

After some tests this seems to works Sad sorry for asking seems I always need to triple check users comments before asking :p


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - mkleynhans - 2012-08-22

Hi Guys,

I am trying to re-write a very basic AMX control system that was controlling a Dharma based system using HTTP API
sendkey commands. eg. 'GET /xbmcCmds/xbmcHttp?command=sendkey(61478) HTTP/1.1' for Up.
I am now trying to get this to work on Dharma and it seems some commands dont work anymore so I am going to
have to change to the JSON method.
I have worked out basic controls. eg. '{"jsonrpc": "2.0", "method": "Input.Up", "params": {}, "id": "10"}' for Up but cannot
find ways of controlling things like Page Up, Page Down, Update Movies, Update Videos, Jump to Movies Folder,
Jump to TV Shows, Context Menu, Info etc. etc.
Is there a need to have a mixture of sendkeys and JSON or is there a practical way of getting all one way commands
working under JSON?

Sorry if this has been answered, I have tried to read through as many pages as I can and have searched for obvious
stuff but have only found some references to Input.ExecuteAction but think that this is for a newer version of XBMC.



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

Sendkeys via http won't work at all when Frodo is released.

For all Json commands you can check the Wiki or use the JSon.Introspect command or directly : https://github.com/xbmc/xbmc/blob/master/xbmc/interfaces/json-rpc/methods.json

Some of the commands you needs may never see light in Json you must use EventServer / Client for that , check Wiki.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - grywnn - 2012-08-23

i'm currently playing around with the new setFooDetails methods, and noticed the following when trying to update episode playcounts:
Code:
17:19:11 T:4664594432   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "VideoLibrary.SetEpisodeDetails", "params": {"episodeid": 222, "playcount": 1 }, "id": 1}
17:19:11 T:4664594432   DEBUG: JSONRPC: Calling videolibrary.setepisodedetails
17:19:11 T:4664594432   DEBUG: JSONRPC: Type mismatch in type
1
Works fine for movies, but not for episodes.
Am i doing anything wrong or did i stumble upon a bug?

argh forgot to mention:
XBMC 12.0-alpha5 git:20120823-bc0813f running on OS X


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

(2012-08-23, 17:25)grywnn Wrote: i'm currently playing around with the new setFooDetails methods, and noticed the following when trying to update episode playcounts:
Code:
17:19:11 T:4664594432   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "VideoLibrary.SetEpisodeDetails", "params": {"episodeid": 222, "playcount": 1 }, "id": 1}
17:19:11 T:4664594432   DEBUG: JSONRPC: Calling videolibrary.setepisodedetails
17:19:11 T:4664594432   DEBUG: JSONRPC: Type mismatch in type
1
Works fine for movies, but not for episodes.
Am i doing anything wrong or did i stumble upon a bug?
With "does not work for episodes" you mean you checked that the playcount didn't change after you ran that request? Because that "Type mismatch in type 1" debug message is not really an error.
I just tested it on a few of my episodes and changing the playcount works fine.




RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Bram77 - 2012-08-24

Is the JSON-rpc service using open sockets and if not...are you planning to implement this?

edit: I'm aiming at the http service


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

What do you mean with "open sockets"? There are currently three ways to use the JSON-RPC API from a remote client:
1. Using HTTP POST requests on the port of the webserver and with the following URL: http://<ip>:<port>/jsonrpc
2. Using WebSockets on the port of the TCP server (9090 by default) and with the following URL: ws://<ip>:<port>/jsonrpc
3. Using a raw TCP socket on the port of the TCP server (9090 by default)

HTTP POST does not support server-side notifications but it has image download capabilities (which the other two don't).


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Bram77 - 2012-08-24

Thanks for explaining, but that I already knew Smile.
With Python and Node.js (probably others too) it's possible to create an open http server connection. It's the same as any other http connection except the connection never closes like a traditional http connection does. This means there is no more three way handshake at every request which is WAY faster and results in a smaller memory footprint. Open sockets are also referred to as 'streaming sockets' if I'm not mistaking.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - grywnn - 2012-08-24

Concerning the watched status of episodes:
Never mind.
Looks like the playcount is updated correctly.
It's my XBMC that doesn't update the checkmarks if the episode was on screen in a list before.
Don't know wether its a skin issue (using confluence) or XBMC related: When i have a season list on screen in XBMC, update the playcount of one of its episodes via JSON, the checkmark isn't updated even if i leave an re-enter the episode list.
Checkmarks apear correctly if a change the status of an episode that hasn't been on screen before.
My guess would be a caching issue.

Edit:
Any episode i update looses it's sd/hd badge when i change the playcount.
Strange.


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

(2012-08-24, 11:31)grywnn Wrote: Concerning the watched status of episodes:
Never mind.
Looks like the playcount is updated correctly.
It's my XBMC that doesn't update the checkmarks if the episode was on screen in a list before.
Don't know wether its a skin issue (using confluence) or XBMC related: When i have a season list on screen in XBMC, update the playcount of one of its episodes via JSON, the checkmark isn't updated even if i leave an re-enter the episode list.
Checkmarks apear correctly if a change the status of an episode that hasn't been on screen before.
My guess would be a caching issue.

Edit:
Any episode i update looses it's sd/hd badge when i change the playcount.
Strange.

See http://trac.xbmc.org/ticket/13173
XBMC cashes GUI listings and if it's not told to re-fetch the list it will just get whatever it displayed before so that's why you don't see the update. I didn't have time to look into a proper fix yet.


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

(2012-08-24, 11:30)Bram77 Wrote: Thanks for explaining, but that I already knew Smile.
With Python and Node.js (probably others too) it's possible to create an open http server connection. It's the same as any other http connection except the connection never closes like a traditional http connection does. This means there is no more three way handshake at every request which is WAY faster and results in a smaller memory footprint. Open sockets are also referred to as 'streaming sockets' if I'm not mistaking.

The only http mechanism I'm aware that may act like this is Keep-Alive of HTTP 1.1.

And while I'm not sure Xbmc webserver do handle 1.1 this would lead to lot's of problems due to the limits at 4 threads in current implementation Smile
So having a long timeout would pause lot's of problem and having a small timeout would not have a lot of interest Smile


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Bram77 - 2012-08-24

It's fast enough now Smile. Thanks for explaining.

Another question... Is it in anyway possible to recursively add directory content to a playlist, without requiring multiple requests or a chained request? I can only find this parameter for Player.Open in the Pictures context.


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

No this is currently not possible but I think there's already a feature request for it somewhere on Trac.


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

Somewhat confused, more than likely me not understand but why does:
Code:
{"jsonrpc": "2.0", "method": "videoLibrary.Gettvshows", "params": { "filter": { "or": [ {"field": "title", "operator": "startswith", "value": "v"},{"field": "genre", "operator": "is", "value": "comedy"} ] } }, "id": 1}
give a union error but change the "or" to an "and" and it will work?


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

Hm you should be able to use "or" and "and" the same way. Do you get an error response or is it just a debug output in the XBMC log? If it's the latter I really need to remove that output as it seems to confuse a lot of people.