Python remote control for Kodi
This is a Python remote control for Kodi with minimal but sufficient basic controls. This remote control acts as a WebSocket Gateway of the UDP Event Server API for more reactivity.
Table of contents
Installation
PyPI
pip install kodi_remotecontrol
Docker Hub
docker pull dmachard/kodi-remotecontrol:latest
Start remote control
As prerequisite, go to System/Settings/Network/Services and activate the two following options
Allow programs on other systems to control KodiAllow control of Kodi via HTTP
After that, you can start the remote control and provides the address of your kodi server.
kodi_remotecontrol --desthost=10.0.0.200
Other available options:
kodi_remotecontrol --help
usage: kodi_remotecontrol [-h] [--destport DESTPORT] [--desthost DESTHOST]
[--bindport BINDPORT] [--bindhost BINDHOST]
optional arguments:
-h, --help show this help message and exit
--destport DESTPORT destination kodi port default=9777
--desthost DESTHOST destination kodi host default=127.0.0.1
--bindport BINDPORT bind on port default=8081
--bindhost BINDHOST bind on host default=0.0.0.0
Available buttons
To interact with the remote control, you need to use a websocket client and
send the following JSON commands to the address ws://<remotecontrol_ip>:8081.
UI Navigation
{"button": "press_up"} // press on up button
{"button": "press_down"} // press on down button
{"button": "press_left"} // press on left button
{"button": "press_right"} // press on right button
{"button": "press_back"} // press on back button
{"button": "press_enter"} // press on enter button
{"button": "press_ctxmenu"} // display contextual menu
{"button": "press_playlist"} // display playlist
{"button": "press_logoff"} // press on logoff button
Player interaction
{"button": "press_play"} // press on play button
{"button": "press_stop"} // press on stop button
{"button": "press_pause"} // press on pause button
{"button": "press_previous"} // press on previous button
{"button": "press_next"} // press on next button
{"button": "press_osd"} // display OSD
Subtitle selection
{"button": "press_subtitle"} // toggle subtitle
Audio track selection
{"button": "press_language"} // toggle language
Websocket client
VueJS front end
A web interface for this project is available.
Basic demo
Copy/paste the following html content in a file and open-it in your web browser. Configure the websocket address.
<html>
<head>
<title>RemoteControl demo</title>
<style type="text/css">
.buttons {
font-size: 1em;
display: flex;
justify-content: center;
}
.button {
padding: 2rem;
border: medium solid;
min-height: 1em;
min-width: 1em;
cursor: pointer;
user-select: none;
}
</style>
</head>
<body>
<div class="buttons">
<div class="play button">Play</div>
<div class="pause button">Pause</div>
</div>
<script>
var websocket = new WebSocket("ws://localhost:8081/");
var play = document.querySelector('.play')
var pause = document.querySelector('.pause')
play.onclick = function (event) {
websocket.send(JSON.stringify({button: 'press_play'}));
}
pause.onclick = function (event) {
websocket.send(JSON.stringify({button: 'press_pause'}));
}
</script>
</body>
</html>
About
| Author | Denis Machard d.machard@gmail.com |
| License | MIT |
| PyPI | https://pypi.org/project/kodi-remotecontrol/ |
Metadata
Release files for kodi-remotecontrol 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kodi_remotecontrol-0.8.0.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kodi_remotecontrol-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.6 kB
Release files / kodi_remotecontrol-0.8.0.tar.gz
| Download URL | kodi_remotecontrol-0.8.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
837a83a00e8308445e2f8bc725f4debca5d9c445ba836c9026ccd6d6511ac29a
|
|
BLAKE2b-256 checksum How to use checksums |
0ed72dc719e39940b5f440937860aa5a7e749871a5b5cc62c902a17b9cf598b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9
|
Release files / kodi_remotecontrol-0.8.0-py3-none-any.whl
| Download URL | kodi_remotecontrol-0.8.0-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3423397faff5a731cbfdb122a2e759d32d13737bde58e4435ad795461ae0f3eb
|
|
BLAKE2b-256 checksum How to use checksums |
8a886e77a299c6e1d0f844c19d4ea22e58f9ab4a480b0bfdfc30138e19c9bfef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9
|