OCDarr automates TV show maintenance in Sonarr based on Plex viewing activity via Tautulli. It ensures that the next episode is ready and cleans up watched episodes based on user-defined preferences. Ideal for keeping your media server tidy and your series up-to-date without manual intervention. Not useful for hoarders. For example, sometimes I start an old show and never finish it, or takes awhile before I really get into it. So This way I dont have full seasons sitting there. I also do not have other users outside my household and am not a rewatcher of tv so I like to delete after a show is watched. This will always have the next episode ready to go and the last episode watched saved just in case. If I need to protect a show because someone else is behind me then I can set certain shows to not delete. If someone prefers getting full season instead of one episode you can do that. For example, if you have a new shows pilot episode only, once its watched the script can then monitor the rest of the season. Keep or delete previous episodes.
Either:
Start by cloning the repository and navigating into the directory:
git clone https://github.com/Vansmak/OCDarr.git
cd OCDarr
After cloning the repository, switch to the main branch:
cd OCDarr
git checkout main
Configuration Environment Setup
Copy the provided .env.example to .env and update it with your Sonarr details:
cp .env.example .env
nano .env # use your preferred text editor
Fill in the environment variables:
SONARR_URL: URL to your Sonarr server. SONARR_API_KEY: Your Sonarr API key.
Docker Compose
Edit the docker-compose.yml file to suit your setup. Make sure the .env file is referenced correctly, and ports are mapped to your preference:
version: '3.8'
services:
sonarr_script:
build:
context: .
dockerfile: Dockerfile
environment:
SONARR_URL: ${SONARR_URL?Variable not set}
SONARR_API_KEY: ${SONARR_API_KEY?Variable not set}
CONFIG_PATH: /app/config/config.json
env_file:
- .env
volumes:
- .:/app
- ./logs:/app/logs
- ./config:/app/config
- ./temp:/app/temp
ports:
- "5001:5001"
restart: unless-stopped
Build and Run with Docker Compose
docker-compose up -d --build
This command builds the Docker image and runs it in detached mode.
OR:
Docker Instructions
Pull the Docker Image
docker pull vansmak/ocdarr:arch64 or amd64
Set Environment Variables or
Create an .env file with the required environment variables:
SONARR_URL=http://sonarr.example.com
SONARR_API_KEY=your_sonarr_api_key
Run the Docker Container
docker run -d \
--env-file .env \
--env CONFIG_PATH=/app/config/config.json \
-p 5001:5001 \
-v ${PWD}/logs:/app/logs \
-v ${PWD}/config:/app/config \
-v ${PWD}/temp:/app/temp \
--restart unless-stopped \
vansmak/ocdarr:amd64,arm64
Once your Docker container is running, it will listen for webhook calls from Tautulli when an episode is deemed as watched. Configure Tautulli to send webhooks to http://
json data exactly like:
{
"plex_title": "{show_name}",
"plex_season_num": "{season_num}",
"plex_ep_num": "{episode_num}"
}
View html to see progress, fine-tune behavior and set rules locally at http://dockerurl:port. Each rule has these four options
get_option: '#' of episodes to get or 'season' for full seasons or 'all' for everything
action_option: 'search' to search episodes, 'monitor' to only monitor.
keep_watched: '#' of watched episodes to keep or 'season' to keep current seasons episodes only OR 'all' will keep everything (no deleting)
monitor_watched: true or false, keep watched episodes monitored or not
** Making and assigning rules
A show can only have one rule at a time. If you select a new rule for a show it will reassign it. If you want to remove a show from a rule so it has none then select none and check that show.
Name them however it makes sense to you.
!important: If you do not assign a show to a rule it will not process that show at all, it will be treated solely by your sonarr settings.
Additional Notes
Set watched criteria in Tautulli general settings. (consider % watched before webhook is sent)
Troubleshooting
If you encounter issues, check the Docker container logs and logs/app.log and ensure all environment variables are correctly set.