This script terminates all running Plex sessions/streams and sends a customizable error message to the users using the Tautulli API.
I have developed this as a basic script to terminate all sessions and notify any Plex users currently watching if the battery of my UPS is low.
The error message will appear to the user as something like this:
-
Create the configuration file:
cp config/config_example.json config/config.json
-
Update the tautulli URL with the url to your Tautulli instance:
e.g.
http://192.168.1.10:8181 -
Update the API key with your own API key for Tautulli:
This can be found in
Settings -> Web Interface -> API -> API key -
Update the message you would like to send after terminating a user's session.
Requires >= Python 3.6+:
-
Create a virtual environment (Optional):
python -m venv .venv
-
Activate the virtual environment on Linux (Optional):
source .venv/bin/activate -
Activate the virtual environment on Windows (Optional):
.venv/Scripts/activate.ps1
-
Install the required dependencies:
pip install -U -r requirements.txt`
Execute the main python script:
python main.py