Credit to /u/OkBoomerEh on reddit
Create a new folder under /docker/purgeomatic and create a file there called purgeomatic.env. You can reference this from the command line as /volume1/docker/purgeomatic/purgeomatic.env
.
To avoid the error "permission denied while trying to connect to the Docker daemon socket," when running the command interactively from the prompt, make sure you run sudo -i
and enter the Synology admin password, which will allow the docker
command to run as root.
To get the script working with scheduled tasks/cron, be sure to disable interactive mode when executing the docker
command by removing the -it
from the command line, otherwise you'll get the error "the input device is not a TTY."
- Download the sample .env file and rename it to purgeomatic.env
- Create a new folder on Synology NAS under
/docker/purgeomatic
and copy purgeomatic.env into that folder. Edit the file as needed (highly recommend uncommenting the dry run line until you are 100% sure things are working). - From the Synology DSM UI set up a Cleanup Movies task:
- In Control Panel → Task Scheduler → Create Scheduled Task → User Defined Script.
- Name the task "Cleanup Movies", and choose the user root.
- In the User Defined Script box paste in
docker run --rm --env-file /volume1/docker/purgeomatic/purgeomatic.env --network=host ghcr.io/ask-me-about-loom/purgeomatic:latest python delete.movies.unwatched.py
- From the Synology DSM UI set up a Cleanup TV Series task:
- In Control Panel → Task Scheduler → Create Scheduled Task → User Defined Script.
- Name the task "Cleanup TV Series", and choose the user root.
- In the User Defined Script box paste in
docker run --rm --env-file /volume1/docker/purgeomatic/purgeomatic.env --network=host ghcr.io/ask-me-about-loom/purgeomatic:latest python delete.tv.unwatched.py
- Click on the task, and then the Run button. Watch your email for results.
I kept running the script in dry-run mode, and it would find nothing regardless of how many days I set in the env file. Turns out that my Tautulli section IDs weren't default for whatever reason. I figured out the section ID by clicking on Libraries in Tautulli, then clicked Movies or TV Shows, then looked at the URL to find the Section ID. Edit those section IDs in the .env file and uncomment those lines.