I donât think changing navigation from json to ssh would be optimal as the latter is slower due to adding the extra steps of opening the ssh tunnel and running an extra program. The delay would be of little consequence for something like calling up an information widow but would be annoying for stepping through your library with the navigation actions.
Perhaps I can simplify the json command a bit so it is not quite as confusing. I will use this command from above as an exampleâŚ
curl.exe -X POST -H "content-type:application/json" http://osmc:osmc@192.168.86.36:80/jsonrpc -d {\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"Input.Right\"}
None of the parts outside of the braces is going to change from command to command for you so lets ignore those for nowâŚ
{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"Input.Right\"}
Because we are working in Windows CMD we had to use backslashes to escape the double quotes (meaning this is how we tell CMD to keep passing along the quotes as regular text to the application being called instead of interpreting the quotes as something it should act on itself). I also removed the spaces inside the braces for a similar reason. Lets revert that for now to make it a bit more readableâŚ
{ "jsonrpc": "2.0", "id": 1, "method": "Input.Right"}
Which should be clear is just using the schemaâŚ
{ "key1": "value1", "key2": value2, "key3": "value3"}
The jsonrpc and id keys are going to be the same for all commands so for the more basic stuff their is really only one key:value pair you would need to swap out to form a different request. So lets use this information on some random example you might find on the interwebsâŚ
curl -s -L -m3 --connect-timeout 5 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"VideoLibrary.Clean", "params": { "showdialogs": false }, "id":1}' http://<MrMC_host>:8080/jsonrpc > /dev/null
We only need pay attention to the request itselfâŚ
{"jsonrpc":"2.0","method":"VideoLibrary.Clean", "params": { "showdialogs": false }, "id":1}
which shows that what we need is the keys for method and params since we already have jsonrpc and id. This is easy enough to insert into the part of your command that is not changing ieâŚ
curl.exe -X POST -H "content-type:application/json" http://osmc:osmc@192.168.86.36:80/jsonrpc -d {\"jsonrpc\":\"2.0\",\"id\":1,}
remembering to remove spaces and insert backslashes to escape any double quotes which gives us the finished commandâŚ
curl.exe -X POST -H "content-type:application/json" http://osmc:osmc@192.168.86.36:80/jsonrpc -d {\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"VideoLibrary.Clean\",\"params\":{\"showdialogs\":false }}
BTW the above command cleans your video library WITHOUT popping up a progress screen in Kodi. If someone is actively using Kodi this is much nicer than calling for a library clean using other methods. Also note that like the â1â value for âidâ the âfalseâ value for âshowdialogsâ is NOT double quoted. This is important as that would change what is a required boolean true/false value and change it to a string which will produce an error.
Iâve been playing around with this quite a bit this week making a batch script maintenance utility for myself and have found there is quite a lot you can do. In your case I would recommend you take a look at thisâŚ
https://kodi.wiki/view/Archive:JSON-RPC_API/v6#Input.Action
If you click [expand] under Input.Action you will see there is a massive amount of control available over what you find as examples in that Kodi forum post.