Some convenient helper scripts and utils for working with Plex and "rr" services
Go to file
2025-04-19 14:18:02 +00:00
radarr Initial Commit 2023-09-15 16:31:27 +00:00
.gitignore Initial Commit 2023-09-15 16:31:27 +00:00
apiconfig-default.py Change sample values to plex from radarr 2023-09-15 17:08:43 +00:00
backup_repo Rename script for backing up the repo to a local filesystem 2025-02-23 14:55:45 +00:00
backupPlex Add the backupPlex script and some documentation in the README to describe its use. 2025-02-23 17:15:22 +00:00
findmissing.py Add a script to find and print info if a video is missing the file on disk 2025-04-19 14:18:02 +00:00
README.md Add the backupPlex script and some documentation in the README to describe its use. 2025-02-23 17:15:22 +00:00
updatecoll.py Move a few things over to the config file 2023-09-15 17:05:03 +00:00

Plex and "arr" Service Utilities

Here lies several scripts, mostly in python, for doing some simple but useful things with Plex and an "arr" services such as Radarr, Sonarr, etc.

Folders

In each folder there should be a file named apiconfig-default.py. This file must be renamed to apiconfig.py and the values inside the file must be edited to reflect your environment.

Settings to be edited for all projects/folders:

  • url = : This should be set to the URL for your service (i.e. http://plex.local.lan:32400).
  • apikey = : This should be set to the API Key for the service. Each service provides this key in a different location so refer to the documentation for the particular service to locate this value.

PlexDev

Settings unique to this project/folder:

  • mediafolder = : This is the top level folder for the media (i.e. videos, etc.) relevant to each service.
  • libraryname = : This is the name of the Plex library in which the programs should operate.
  • colmap = {} : This is a dictionary containing entries mapping folder names to collection names. Each top level folder inside "mediafolder" you wish to have collections created/maintained for should be entered here. Each entry must be on a new separate line between the { and } lines and all but the last line must have a trailer comma ,.
    • A folder named "SciFi" for which you want to have a collection named "Sci-Fi" would look like this:
      • 'SciFi': 'Sci-Fi'

This is the top level repository folder and contains scripts meant to be used on the PlexAPI.

  • updatecoll.py : This program creates collections for each top level movie folder and ensures each movie is a member of a collection named based on the main folder in which it resides (i.e. movies in the Scary/ folder are added to the "Scary" collection). This value must have a trailing slash.

PlexDev/radarr

  • unmonitor.py : This program checks each movie in Radarr and sets it to be unmonitored if it already has a downloaded file/movie associated with it. This helps to ensure that Radarr will never seek to automatically replace files.

Cron Jobs

Here are a couple example entries for cron to run both the updatecoll.py and unmonitor.py scripts. The full path to where the python scripts are located must be referenced in the crontab entry.

30 3 * * * /usr/bin/python /home/user/PlexDev/updatecoll.py 1>/dev/null 2>&1
35 3 * * * /usr/bin/python /home/user/PlexDev/radarr/unmonitor.py 1>/dev/null 2>&1

Backup

  • backupPlex : This script is designed to be placed in the /etc/cron.daily folder. The source (/var/lib) and desitination (/backup by default) may need to be altered to reflect your local environment.
    • The script can be run interactively with a -v command line argument. This will display a verbose accounting of what is being backed up. This is particularly useful when running the script for the first time to commit the initial synchronization.