Deleterr
repository·main·Indexed 43 days ago
https://github.com/rfsbraz/deleterrAn intelligent media library cleanup tool for Plex that integrates with Radarr, Sonarr, and Tautulli to automatically delete media files based on watch history, age, and streaming availability. Features include a 'Leaving Soon' notification system, disk space thresholds to trigger deletions, and extensive exclusion rules based on metadata, quality profiles, and external integrations like Trakt, MDBList, and JustWatch.
What's inside Deleterr
- Deleterr is an automated media library management tool for Plex that uses Radarr, Sonarr, and Tautulli to identify and delete media files based on user-defined criteria. It is designed to keep media libraries clean by running on a schedule to remove content that meets specific rules (such as watched status or age) while providing mechanisms to notify users before deletion occurs.
Understand the two types of Deleterr notifications
mainDeleterr distinguishes between notifications intended for administrators and those intended for end-users:
- Run Summary: Sent to Admins to report exactly what was deleted during a specific run.
- Leaving Soon: Sent to Users to alert them about content scheduled for deletion so they can watch it before it is removed.
Important:
leaving_soonnotifications are configured separately from run summary notifications and do not inherit provider settings from the parentnotificationsblock.Trakt matching logic and limitations
mainMatching Logic
- Movies are matched using their TMDB ID.
- TV Shows are matched using their TVDB ID.
Known Limitations
- Authentication: Deleterr authenticates using the Client ID only (no OAuth). Consequently, Favorites lists can only be accessed if the user's profile is set to public.
- Unsupported Lists: Periodic lists such as
watched/weeklyorcollected/monthlyare not currently supported.
How Deleterr operates
mainDeleterr follows a five-step lifecycle to manage your media:
- Connects: Establishes connections to your Plex, Tautulli, and Radarr/Sonarr instances.
- Analyzes: Evaluates watch history and media metadata.
- Filters: Applies your rules (e.g., watched status, age, and exclusions) to identify candidates for deletion.
- Deletes: Executes the deletion of matching media through the Radarr or Sonarr APIs.
- Optionally triggers: Performs post-deletion actions like triggering library scans or adding list exclusions.
Understand `last_watched` special behavior
mainWhen using the
last_watchedfield, unwatched items always sort first, regardless of whether you set the order toascordesc.The
ordersetting only controls how watched items are sorted among themselves. This behavior ensures that unwatched content is prioritized for deletion before recently-watched content.Configure Per-User Requester Watch Protection
mainThis feature protects content requested via Seerr until the specific requester has actually watched it, using Tautulli watch history. This prevents content from being deleted if the person who requested it hasn't seen it yet, but allows normal deletion once they have.
Workflow:
- Deleterr identifies if an item was requested via Seerr.
- It checks the requester's watch history in Tautulli.
- If the requester has not watched it, the item is protected.
- If the requester has watched it, normal deletion rules apply.
Key Configuration Options within
exclude.seerr.protect_unwatched_requesters:enabled: (boolean) Activates the protection.min_request_age_days: (integer) Minimum age of a request before protection applies (grace period).max_protection_days: (integer) Hard limit on how long an item is protected, regardless of watch status.user_mapping: (map) Used if Seerr and Tautulli usernames differ. Maps Seerr usernames to Tautulli usernames.
# Example: Protect unwatched requesters with a 90-day grace period and 1-year max protection libraries: - name: "Movies" exclude: seerr: mode: "exclude" protect_unwatched_requesters: enabled: true min_request_age_days: 90 max_protection_days: 365Important Safety Warnings for Deleterr
mainWARNING: DATA LOSS RISK
DO NOT USE THIS WITH MEDIA CONTENT YOU CAN'T AFFORD TO LOSE.
To mitigate risk, it is recommended to turn on the recycle bin in your Sonarr/Radarr settings. This allows for file recovery if a deletion was unintended. Note that the recycle bin is not recommended for remote mounts.
Configure Seerr/Overseerr exclusion modes
mainYou can define how Seerr/Overseerr requests affect deletion logic at the library level using the
modeoption:exclude(default): Protects requested media from deletion. Use this to ensure content users asked for is kept.include_only: Only deletes media that was requested through Seerr. All other content is skipped.
# Protect requested media exclude: seerr: mode: "exclude" # Only delete requested media exclude: seerr: mode: "include_only"Supported Trakt list URL formats
mainDeleterr supports several types of Trakt lists for exclusions. Ensure the URLs follow these patterns:
- Official Lists: e.g.,
https://trakt.tv/movies/trending,https://trakt.tv/shows/popular. - User Watchlists:
https://trakt.tv/users/yourusername/watchlist. - User Favorites:
https://trakt.tv/users/yourusername/favorites(Note: The user's profile must be public). - Custom User Lists: Any public list, e.g.,
https://trakt.tv/users/username/lists/list-slug.
- Official Lists: e.g.,
Use multi-level sorting
mainYou can sort by multiple fields by providing a comma-separated list in the
fieldkey. The first field is the primary sort, and subsequent fields act as tie-breakers.Provide a comma-separated list in the
orderkey to specify the direction for each field. If you provide fewer orders than fields, the last order in the list is reused for all remaining fields.# Sort by last_watched descending, then size descending sort: field: "last_watched,size" order: "desc,desc" # Sort by last_watched, size, and title, all descending (reusing last order) sort: field: "last_watched,size,title" order: "desc"How exclusions work in Deleterr
mainExclusions are used to protect specific media items from being deleted. If an item matches any exclusion rule, it is skipped entirely. Deleterr uses OR logic for exclusions, meaning a single match is sufficient to protect an item.
Exclusions are configured within a
librariesblock using theexcludekey. You can combine Metadata, Radarr, Sonarr, and Integration exclusions within the same library block.libraries: - name: "Movies" radarr: "Radarr" action_mode: "delete" exclude: # Rules go hereUnderstand JustWatch title matching and rate limiting
mainTitle Matching
JustWatch attempts to match your media to its database using:
- Exact title + exact year
- Case-insensitive title + exact year
- Case-insensitive title + 1-year tolerance (to account for regional release date variations)
If no match is found, the item is not excluded.
Rate Limiting
If JustWatch returns an HTTP 429 (Too Many Requests) error:
- Deleterr logs a warning on the first occurrence.
- Subsequent rate-limited items are silently skipped.
- The rate limit resets automatically.
Tip: If you hit rate limits frequently, reduce
max_actions_per_runor run Deleterr less often.