Skip to content
Casvt edited this page May 12, 2022 · 3 revisions

Summary

  1. First of all, download the script onto your computer.
  2. Inside the file, fill the required variables. More info about this can be found below.
  3. Some scripts just need to be run manually, but others need to be setup in sonarr/radarr/tautulli or need to be run at an interval (like 5 min or 12 hours). Instructions on how to run the script can be found inside the file.

Variables

Inside the scripts, there are variables that you need to fill in order for the script to work. These variables are named after the value that they should have. They all follow the same logic: [software]_[requested value]. So if the variable is called sonarr_port, the value should be the port that sonarr is running on (default is 8989). It will look like this:

sonarr_port = '8989'

Examples of variables and their expected values:

plex_ip = '192.168.2.15'
sonarr_ip = '192.168.2.15'
radarr_ip = '192.168.2.15'

plex_port = '32400'
#when there is a base url added (e.g. in sonarr or radarr), append it to the port:
sonarr_port = '8989/sonarr'
radarr_port = '7878'

plex_api_token = 'abcdefghijklmnopqrst'
sonarr_api_token = 'abcdefghijklmnopqrstuvwxyz'
radarr_api_token = 'abcdefghijklmnopqrstuvwxyz'

The api token of sonarr or radarr can be found in the web-ui under Settings -> General -> Security -> API Key

To find the plex api token:

  1. Find where the data directory of plex is located for your OS here
  2. Open the file Preferences.xml inside the data directory found in step 1
  3. Find the value of PlexOnlineToken (e.g. PlexOnlineToken="abcdefghijklmnopqrst" -> abcdefghijklmnopqrst)
  4. Enter it as the value for plex_api_token (as seen above)

IMPORTANT: Only fill the variables at the top of the script. Never give values to variables in the middle of the script.

Dependencies

Some python scripts have dependencies in order for them to work. You need to install those dependencies before you run the script. The dependencies that a script has can be found at the top of the python script under 'Requirements'.

Install the dependency using the following command ([requirement] should be replaced with the name of the dependency):

python3 -m pip install [requirement]

Do this for every dependency listed in the documentation inside the script.

Running the script

How you run the script depends on what the script needs. Some need to be run manually, but others need to be run at an interval or need to be setup in a software like sonarr/radarr or tautulli. How the script needs to be run can be found inside the file.

You can also run python scripts in a different way. Every python script has a function in it that has the same name as the filename. This function contains the functionality of the script. When running the script manually, this function is run with the required arguments but you can also import the function yourself into your own script. This way, you import the functionality of the script where you can run it as many times as you want and the way you want.

Clone this wiki locally