A little script that sends a JSON request to stop Kodi and then restarts it.
Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
data
resources
.gitignore
COPYING.txt
LICENSE.txt
README.txt
changelog.txt
execute.py

README.txt

restart.kodi
================
PLEASE NOTE THAT AS OF 0.2.0 THERE ARE SUBSTATIVE CHANGES. IF YOU ARE UPGRADING FROM 0.1.x OR EARLIER, IT WOULD BE A GOOD IDEA TO USE THE SETTINGS-EXAMPLE.PY FILE AGAIN FROM SCRATH AND READ THROUGH THIS README AGAIN.

This python script does a really simple thing.  It issues a JSON request for Kodi to quit, and then starts Kodi back up.  Optionally, if Kodi isn't running at all it will also start Kodi.  I mostly use this for when the Kodi UI gets stuck (most of the time JSON requests keep working), and quitting Kodi this way will save any unsaved skin settings you've changed.

Prerequisites:
1. You need to have python 2.7.x installed on your system (3.4.x might work, but I haven't tested it).
<https://www.python.org/downloads/>

2. You need to add the psutil and requests modules to your install.
From the cmd window:   pip install psutil
                       pip install requests

3. The script uses websocket to communicate with Kodi by default with a fallback to HTTP. To enable websocket support you need to add the websocket-client module to your python install.  After install the script will use websockets to communicate with Kodi unless you turn it off.  See below for information on configuring Kodi to use websockets for communication.
From the cmd window:   pip install websocket-client


Configuration:
---Kodi settings:
In SYSTEM->SETTINGS->SERVICES->REMOTE CONTROL:
  a. enable "Allow remote control from applications on this system"
If you are not using websocket support, then instead in SYSTEM->SETTINGS->SERVICES->WEBSERVER
  a. enable "Allow remote control via HTTP"
  b. set a user name and password (script default assumes kodi for both).
  c. if needed, change the port (i.e. if something else is running on 8080).
---Script settings:
In the data directory of the script, rename settings-example.py to settings.py.  Review the settings file and make changes as needed.  If you're not sure what a setting does even after reading the comments in the settings.py file, you can probably leave it at the default.

Execution:
To execute, run the execute.py script using your OS's python interpreter.