class, http_port=8080, websocket_port=9090, username=None, password=None, **kwargs)[source]

Plugin to interact with a Kodi media player instance


  • kodi-json (pip install kodi-json)
  • websocket-client (pip install websocket-client), optional, for player events support
__init__(host, http_port=8080, websocket_port=9090, username=None, password=None, **kwargs)[source]
  • host (str) – Kodi host name or IP
  • http_port (int) – Kodi JSON RPC web port. Remember to enable “Allow remote control via HTTP” in Kodi service settings -> advanced configuration and “Allow remote control from applications” on this system and, optionally, on other systems if the Kodi server is on another machine
  • websocket_port (int) – Kodi JSON RPC websocket port, used to receive player events
  • username (str) – Kodi username (optional)
  • password (str) – Kodi password (optional)
back(offset=60, player_id=None, *args, **kwargs)[source]

Move the player execution backward by delta_seconds

Parameters:offset (float) – Backward seek duration (default: 60 seconds)
back_btn(*args, **kwargs)[source]

Simulate a back input event

clean_audio_library(*args, **kwargs)[source]

Clean the audio library

clean_video_library(*args, **kwargs)[source]

Clean the video library

down(*args, **kwargs)[source]

Simulate a down input event

forward(offset=60, player_id=None, *args, **kwargs)[source]

Move the player execution forward by delta_seconds

Parameters:offset (float) – Forward seek duration (default: 60 seconds)
fullscreen(*args, **kwargs)[source]

Set/unset fullscreen mode


Get the list of active players

get_albums(*args, **kwargs)[source]

Get the list of albums in the audio library

get_artists(*args, **kwargs)[source]

Get the list of artists in the audio library

get_movies(*args, **kwargs)[source]

Get the list of movies on the Kodi server

get_songs(*args, **kwargs)[source]

Get the list of songs in the audio library

is_muted(*args, **kwargs)[source]

Return the muted status of the application

left(*args, **kwargs)[source]

Simulate a left input event

mute(*args, **kwargs)[source]

Mute/unmute the application

notify(title, message, *args, **kwargs)[source]

Send a notification to the Kodi UI

pause(player_id=None, *args, **kwargs)[source]

Play/pause the current media

play(resource, *args, **kwargs)[source]

Open and play the specified file or URL

Parameters:resource – URL or path to the media to be played
quit(*args, **kwargs)[source]

Quit the application

repeat(player_id=None, repeat=None, *args, **kwargs)[source]

Set/unset repeat mode

right(*args, **kwargs)[source]

Simulate a right input event

scan_audio_library(*args, **kwargs)[source]

Scan the audio library

scan_video_library(*args, **kwargs)[source]

Scan the video library

seek(position, player_id=None, *args, **kwargs)[source]

Move to the specified time position in seconds

Parameters:position (float) – Seek time in seconds
select(*args, **kwargs)[source]

Simulate a select input event

send_text(text, *args, **kwargs)[source]

Simulate a send_text input event

Parameters:text (str) – Text to send
set_position(position, player_id=None, *args, **kwargs)[source]

Move to the specified time position in seconds

Parameters:position (float) – Seek time in seconds
set_volume(volume, *args, **kwargs)[source]

Set the application volume

Parameters:volume (int) – Volume to set between 0 and 100
shuffle(player_id=None, shuffle=None, *args, **kwargs)[source]

Set/unset shuffle mode

stop(player_id=None, *args, **kwargs)[source]

Stop the current media

up(*args, **kwargs)[source]

Simulate an up input event

voldown(step=10.0, *args, **kwargs)[source]

Volume down (default: -10%)

volup(step=10.0, *args, **kwargs)[source]

Volume up (default: +10%)