/Plex-Cleaner

A script to clean up movies and episodes in Plex Media Server

Primary LanguagePython

Please update the script to version 1.94 to avoid problems with your server by creating too many devices!

Plex Cleaner

A Script to clean up space on your Plex Media Server!

Automatically delete watched episodes or movies. Lots of customizable options.

Configuration

To begin make a copy of Cleaner.conf.default and rename it as Cleaner.conf. You can then make edits to the Cleaner.conf file with your own settings. Descriptions of the settings are in the PlexCleaner.py script.

Alternatively you can create a config file by running the script with the option --dump [Path to Config file].

python PlexCleaner.py --dump "/path/to/config/file"

PlexCleaner will then create a config file at the path specified with example values. You can then make edits to the config file based on your preferences. The formatting is very specific for the config file, if you have difficulty editing it, you can edit the default values in the script and then run the --dump argument to create a properly formatted config file.

By default plex will check in the users home directory for a .plexcleaner file, then in the current directory for a .plexcleaner or Cleaner.conf file. If you stored the config file in another location you will need to load the config file using the --config argument. To do so you would run PlexCleaner as:

python PlexCleaner.py --config "/path/to/config/file"

If the script is updated and you need to update your config file without losing your settings you can run PlexCleaner with --update_config argument. This will add any new configuration settings without overwriting any of your settings in the config file.

After you have entered your settings, it is recommended you first run the script with the --test flag. The --test flag will run the script without performing any actions, and flagging files that would be marked for deletion, copying, or moving. Once you have determined that the output is correct, you can run the script without the --test flag. The --test flag will also output the token used to login so you don't have to leave login details in the script.

Docker

You can find a dockerized version of this script here: https://github.com/NitriKx/docker-Plex-Cleaner

docker pull nitrikx/plex-cleaner
docker run -ti -v /path/to/config/folder nitrikx/plex-cleaner

Crontab and monitoring with Healthchecks.io

Create an account on https://healthchecks.io, and create up a new health check. Create a new file at healthchecksio_id, and paste your health check ID.

Set up a crontab entry to run the script every day at 4am:

$ crontab -e

0 4 * * * /opt/Plex-Cleaner/run_plex_cleaner.sh

Support

If you want to support me (does not equal development):
Buy Me a Coffee    or    Buy Me a Beer