Kodi/XBMC bash script to send Kodi commands from the command line
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Steven Saus 80fe57e3f6 making sure xauth doesn't clobber itself 3 years ago
restart_kodi making sure xauth doesn't clobber itself 3 years ago
.kodirc Added library maintenance, cleaned up code, added external rc file for security. 7 years ago
LICENSE Initial commit 10 years ago
README.md Documenting -l option 7 years ago
kodi-cli typo 7 years ago
playlist_to_kodi Added playlist playing option to kodi-cli 7 years ago

README.md

kodi-cli

Kodi/XBMC bash script to send Kodi commands using JSON RPC. It also allows sending YouTube videos to Kodi.

Usage

kodi-cli -[p|i|s|(y|q) youtube URL/ID|t "text to send"|o "youtube title"]

Setup

You must either put your Kodi setup (found under "Interfaces") in the first few lines of the script itself, or put a file named .kodirc in your $HOME directory. This file (example provided) contains only four lines in this specific order:

The Kodi Host
The port Kodi listens on (the webserver port)
Username
Password

Arguments

 -p Play/Pause the current played video
 -s Stop the current played video
 -j Skip forward in the current played video     
 -k Skip backward in the current played video     
 -y play YouTube video. Use either URL/ID (of video)
 -q queue YouTube video to the current list. Use either URL/ID (of video). Use instead of -y.
 -o play YouTube video directly on Kodi. Use the name of video.
 -v interactive volume control
 -i interactive navigation mode. Accept keyboard keys of Up, Down, Left, Right, Back,
    Context menu and information
 -l Play current playlist (most useful after using -q a few times)
 -t 'text to send'
 -u Increment the volume on Kodi
 -d Decrement the volume on Kodi
 -f toggle fullscreen
 -m Update libraries
 -n clean libraries
 -h showing this help message

Dependencies

  • curl
  • Kodi

Optional dependencies

  • mps-youtube on the machine running Kodi for the -o option to work.

Advanced usage

With the addition of a few other tools, most notably

You can create a dialog to download and sequentially (and with confirmation) play entire playlists - defaulting to your Watch Later playlist - on your Kodi, acting like a kind of remote "casting" program. See the script playlist_to_kodi for an example.