General > AV Control

Kodi V18 Leia breaks all my http json commands sent from Vera

(1/2) > >>

cw-kid:
Hi

I just updated my Kodi PC to V18 Leia only to discover all my http URL json commands no longer work.

Seems Kodi does now not accept simple one line http Get commands. You have to use Post instead.

This was the command that previously worked to update the Kodi video library.


--- Code: ---http://192.168.1.5:8080/jsonrpc?request={ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"
--- End code ---

And in the LUA code area of a Vera scene I use this code:


--- Code: ---luup.inet.wget("http://192.168.1.5:8080/jsonrpc?request={ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}")
--- End code ---

I saw this Kodi wiki page: https://kodi.wiki/view/HOW-TO:Remotely_update_library

But how do you now send (Post) json commands from Vera to Kodi now?

akbooer:
There's a new luup function luup.inet.request() documented here...

http://wiki.mios.com/index.php/Luup_Lua_extensions#function:_request

This will allow you to do POST requests and you can use the dkjson module to encode Lua tables into JSON.

cw-kid:
Hi Akbooer

Thank you for your reply.

I am not a coder and just about managed previously to send that video library update command from Vera to Kodi.

Seems they have now made it much harder to send commands to Kodi.

I was hoping to find some working examples of how to create a Vera scene or PLEG action with code to send a command to Kodi.

I did search the forum via Google for Kodi v18 leia but didn't find anything.

The Kodi wiki pages says this is the new format of the command:

4. HTTP (does not work in v18 Leia)
To add new content to the library (Update):

Video: http://<User>:<Password>@<hostname>:<port>/jsonrpc?request={"jsonrpc":"2.0","method":"VideoLibrary.Scan"}

cw-kid:
On my Windows PC using CURL this command works and starts the video library update scan on the Kodi V18 Leia PC.


--- Code: ---C:\curl>curl -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.Scan\", \"id\": \"mybash\"}" -H "content-type:application/json" http://user:password@192.168.1.5:8080/jsonrpc
HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 45
Content-Type: application/json
Cache-Control: private, max-age=0, no-cache
Accept-Ranges: none
Date: Wed, 13 Feb 2019 17:52:30 GMT

{"id":"mybash","jsonrpc":"2.0","result":"OK"}
C:\curl>
--- End code ---

Maybe it would be easier to send a curl command from Vera to Kodi ?

akbooer:
You can issue any shell command from a scene Lua script with a one-liner, simply wrapping the command string with os.execute().


--- Code: ---os.execute "any shell command you like, eg. curl"

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version