How to Download Scripts from Github
Click on the Raw button on the script page to get the actual script file, then use File > Save As.. to save the script.
Do not use right click > Save As.. on the script link as this will save the HTML GitHub page instead of the script.
How to Set Up a Custom Script in Tautulli
-
Go to Settings > Notification Agents > Add new notification agent > Script.
-
Set a "Script Folder" and select a "Script File".
-
Select the triggers that will be used to run the script. (e.g. Playback Start, Playback Stop).
-
If you want to limit when the script runs, add custom conditions to the agent.
-
Set the arguments that should be passed to the script.
- Note: Do not fill in the Tautulli notification
{parameters}
.
- Note: Do not fill in the Tautulli notification
-
Save. Voilà, all done!
-
If you are using the "Test Notifications" tab for the script, you must fill in all the Tautulli
{parameters}
with actual values.- For example script arguments:
--jbop stream --username {username} --sessionId {session_id}
- You must fill in the
{username}
and{session_id}
:--jbop stream --username MyPlexUsername --sessionId a0elgoy822nso9tr3l0coh
- For example script arguments:
Environment Variables
Tautulli will pass the following environment variables to the script.
Variable | Description |
---|---|
PLEX_URL |
The URL used to connect to the Plex server (e.g. http://127.0.0.1:32400 ). |
PLEX_TOKEN |
The admin's Plex token. |
PLEX_USER_TOKEN |
The user's Plex token only available for notifications with a user context (i.e. Playback triggers). |
TAUTULLI_URL |
The URL used to connect to the Tautulli server (e.g. http://127.0.0.1:8181 ). |
TAUTULLI_PUBLIC_URL |
The Public Tautulli Domain only if set in the Tautulli settings. |
TAUTULLI_APIKEY |
The Tautulli API key. |
Windows Script Guide
Note: These instructions only apply if you are running a Python script.
How to Install Python
-
Disable the Windows Python app execution aliases.
- Search for "Manage app execution aliases" in your Windows settings. (screenshot)
- Disable
python.exe
andpython3.exe
app execution aliases. (screenshot)
-
Download the latest version of Python from python.org and run the installer.
-
In the Python installation wizard check the option to "Add Python to
PATH
", then click on "Customize installation". (screenshot) -
Under the Advanced Options check the options "Install for all users" and "Add Python to environment variables". (screenshot)
-
Finally, click on "Install".
-
You can check if Python is installed properly by opening up the Windows command line and running the command
python -V
(note capital letterV
) and it should tell you the version of Python installed. (screenshot)
How to Install Python Packages
-
Check which Python packages your script requires. Some script authors will list the requirements at the top of the script (example), otherwise contact the script author. You can also just try running the script (see below) and see which
ModuleNotFoundError
you get which will tell you which packages are needed.- Example error message:
ModuleNotFounderror: No module named 'plexapi'
means you need to install theplexapi
package.
- Example error message:
-
Install packages by opening up the command line and running the command:
python -m pip install <package>
- Example to install the
plexapi
package (screenshot):python -m pip install plexapi
- Example to install the
requests
package (screenshot):python -m pip install requests
- Example to install the
How to Run a Python Script Manually
Open up the command line and run the script you downloaded using Python with the following command:
python "<path to script file>" --additional arguments
- Note:
--additional arguments
depends on the individual script. - Example:
python "C:\Users\JohnDoe\Documents\Scripts\hide_episode_spoilers.py" --rating_key 69420 --blur 25