Deleterr

repository·main·Indexed 43 days ago

https://github.com/rfsbraz/deleterr

An 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.

Tokens
22.1K
Snippets
77
Records
97
Agent score
56%

What's inside Deleterr

  1. Overview of Deleterr

    main
    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.
  2. Understand the two types of Deleterr notifications

    main

    Deleterr 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_soon notifications are configured separately from run summary notifications and do not inherit provider settings from the parent notifications block.

  3. Trakt matching logic and limitations

    main

    Matching 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/weekly or collected/monthly are not currently supported.
  4. How Deleterr operates

    main

    Deleterr follows a five-step lifecycle to manage your media:

    1. Connects: Establishes connections to your Plex, Tautulli, and Radarr/Sonarr instances.
    2. Analyzes: Evaluates watch history and media metadata.
    3. Filters: Applies your rules (e.g., watched status, age, and exclusions) to identify candidates for deletion.
    4. Deletes: Executes the deletion of matching media through the Radarr or Sonarr APIs.
    5. Optionally triggers: Performs post-deletion actions like triggering library scans or adding list exclusions.
  5. Understand `last_watched` special behavior

    main

    When using the last_watched field, unwatched items always sort first, regardless of whether you set the order to asc or desc.

    The order setting only controls how watched items are sorted among themselves. This behavior ensures that unwatched content is prioritized for deletion before recently-watched content.

  6. Configure Per-User Requester Watch Protection

    main

    This 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:

    1. Deleterr identifies if an item was requested via Seerr.
    2. It checks the requester's watch history in Tautulli.
    3. If the requester has not watched it, the item is protected.
    4. 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: 365
  7. Important Safety Warnings for Deleterr

    main

    WARNING: 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.

  8. Configure Seerr/Overseerr exclusion modes

    main

    You can define how Seerr/Overseerr requests affect deletion logic at the library level using the mode option:

    • 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"
  9. Supported Trakt list URL formats

    main

    Deleterr 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.
  10. Use multi-level sorting

    main

    You can sort by multiple fields by providing a comma-separated list in the field key. The first field is the primary sort, and subsequent fields act as tie-breakers.

    Provide a comma-separated list in the order key 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"
  11. How exclusions work in Deleterr

    main

    Exclusions 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 libraries block using the exclude key. 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 here
  12. Understand JustWatch title matching and rate limiting

    main

    Title Matching

    JustWatch attempts to match your media to its database using:

    1. Exact title + exact year
    2. Case-insensitive title + exact year
    3. 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_run or run Deleterr less often.