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 - mikebzh44 - 2012-06-08

I would say :

Code:
curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Export", "param" : {"images": "true"}, "id": "mybash"}' -H 'content-type: application/json;' http://htpc:8080/jsonrpc



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

(2012-06-08, 04:04)rickles Wrote: Hi, I have spent way too much time trying to figure this out so I hope someone can help me. I am using curl to remotely export my video library from the terminal:

Code:
curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Export", "id": "mybash"}' -H 'content-type: application/json;' http://htpc:8080/jsonrpc

I want to include the "images": "true" option so that my fanart and thumbnails are exported too. Can someone show me how to add it to the above command? Thanks very much.

Code:
curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Export", "pararms": { "options": { "images": true } }, "id": "mybash"}' -H 'content-type: application/json;' http://htpc:8080/jsonrpc



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

I thought I'd test out the new filtering which looks like it's gone in now. Using VideoLibrary.GetMovies with any kind of sorting doesn't work. Everything is always in movieid order with or without using limits.


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

Holy crap I actually didn't wanna push the JSON-RPC stuff yet because it's not done. That's what you get for trying to get something in during the current merge window.


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

I did wonder why it was only on the video library. The speed looks good with limiting anyway Smile


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

I reverted the json-rpc related commit for now and will add it properly ASAP. Sorry about that.


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

I may be missing something blindingly obvious but are websockets not working with Firefox? I'm using 13 and the XBMC log says "WebSocket [RFC6455]: invalid "connection" received". The http://www.websocket.org/echo.html works though. Chrome is fine. Is anyone working with websockets and Firefox?


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

Because Firefox seems to send "Connection: keep-alive, Upgrade" instead of the expected "Connection: Upgrade" in the websocket handshake. Will have to check with RFC6455 if that's "legal" or not.

EDIT: OK RFC6455 states that the "Connection" header must CONTAIN "Upgrade" so I've fixed that. Now establishing a connection and sending JSON-RPC requests works but disconnecting throws an error. Once I've figured that out I'll push the fixes. Thanks for the report.


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

OK I've pushed the fix for establishing a websocket connection with Firefox. But I couldn't really figure out why it fails on the disconnect. It seems like it doesn't expect a Close frame as a response to it's own Close frame but the RFC states
Quote:If an endpoint receives a Close frame and did not previously send a Close frame, the endpoint MUST send a Close frame in response.
so XBMC has to send that Close frame. If I don't send that Close frame and just close the TCP connection, the error disappears. While that also works fine in Chrome and also seems to be what the websocket server implementation of www.websocket.org does (looking at the sent packets in Wireshark there's no response from websocket.org after the Close frame) it is not what the RFC states.


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

It does seem that Mozilla and Google are becoming "Old" Microsoft like as Microsoft become more compliant. Anyway, thanks for the quick fix.


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

Internally generated thumbnails don't appear to be sent. To be clear: TheTVDB doesn't have an image for an episode so XBMC takes a random screen shot. The "thumbnail" property for that episode is empty. Bug ticket?


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

Yes please and CC me and jmarshall.


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

Is Firefox working with websockets for you now? I refresh and it worked once (didn't pay any attention as it was working). Since then I've not been able to get it to work again the log has:
Code:
00:06:47 T:2796526448   DEBUG: JSONRPC Server: New connection detected
00:06:47 T:2796526448    INFO: JSONRPC Server: New connection added
Which would suggest it's working. From what I can tell from Wireshark it's not "switching protocol". Is this just me?


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

Works perfectly fine for me with Firefox 13 on win32. That part of the debug log states the same. What does not work after you connected? Is this with your own implementation or with the echo test from websocket.org?


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

It's very weird. I fired up my old laptop to test and it works fine on there. My desktop just won't connect. It times out and FF says it can't connect. The echo test site works without a problem. I guess it's just limited to my desktop.