Skip to main content

Python remote control for Kodi server

Project description

Python remote control for Kodi

License: MIT PyPI - Python Version

Author Denis Machard d.machard@gmail.com
License MIT
PyPI https://pypi.org/project/kodi-remotecontrol/

This is a Python remote control for Kodi with minimal but sufficient basic controls.

This remote control acts as a websocket proxy of the Event Server API for more reactivity.

Table of contents

Installation

pip install kodi_remotecontrol

Start remote control

As prerequisite, go to System/Settings/Network/Services and activate Allow programs on other systems to control Kodi. 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

Basic demo

<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>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kodi_remotecontrol-0.5.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kodi_remotecontrol-0.5.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file kodi_remotecontrol-0.5.0.tar.gz.

File metadata

  • Download URL: kodi_remotecontrol-0.5.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for kodi_remotecontrol-0.5.0.tar.gz
Algorithm Hash digest
SHA256 a0973c681948cdcbdea0d351a199bf3be9f73f2dffb1a2b29fdc5a99c0a45944
MD5 5dc10d79ba7045810df751bc405ea434
BLAKE2b-256 ba09f6fe109e57e5c556a9ed7d70b06c0d5fa22e3ac01f65a9aab2a7348f90a4

See more details on using hashes here.

File details

Details for the file kodi_remotecontrol-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: kodi_remotecontrol-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for kodi_remotecontrol-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 906a9391f92bb58a77b3b956a48f016ccd194eda563acaf1b2c568a87700138f
MD5 2ed5939c21d28a6a5cfb509a3d38fd95
BLAKE2b-256 d0455a93b37f0dd9131c261166f3973e4d321b025f55187b7d82ac75916032e8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page