I am trying to make controlling kodi easier with keyboard shortcuts or from the terminal. Something like how I can control spotify with DBUS or with keyboard shortcuts. I came across this link but I have no idea how to use JSON.
I am using Kodi 17.6 krypton and Ubuntu 18.04.
1 Answer
You can use the built-in RPC api
See the Official documentation : https://kodi.wiki/view/JSON-RPC_API
- Enable http remote control (kodi system settings)
- Write some script for your need
An exemple : clean video database
#!/bin/bash ## Configure your XBMC RPC details here XBMC_HOST=192.168.0.200 XBMC_PORT=80 XBMC_USER=osmc XBMC_PASS=osmc function xbmc_req { curl -s -i -X POST --header "Content-Type: application/json" -d "$1" http://$XBMC_USER:$XBMC_PASS@$XBMC_HOST:$XBMC_PORT/jsonrpc } # Clean xbmc_req '{ "jsonrpc": "2.0", "method": "VideoLibrary.Clean", "id": "mybash"}';