# PlexReaper > Find what nobody wanted. Decide with evidence. Remove it through Radarr/Sonarr. PlexReaper scores every movie and show on a shared Plex server for removal, using **what people actually did** rather than a single "watched" bit: - Playback sessions from **every Tautulli instance** you run, classified by how far they got. A genuine watch is 85%+. A session that stopped between 15% and 85% is someone who tried it and bailed, which counts *against* the title. A short session by the admin right after the file arrived is quality sampling and is ignored. - Plex's own all-accounts history as a weak prior for watches before Tautulli. - Age, size, bytes-per-hour (bloated encodes), rating, collections, and how far into a show anyone got. Each title gets a **reap score** from 0 to 100 made of named signals with one-line reasons, and you review them in a terminal UI that remembers every decision. See [`docs/design-brief.md`](docs/design-brief.md) for the model and the phase plan. **Status: phase 2.** Scanning, scoring, the TUI and the decision ledger work, and marked titles can be executed through Radarr/Sonarr: `reap` unmonitors and deletes the files (the `*arr` entry stays so the title can be re-requested), `downgrade` switches the quality profile, deletes the files and triggers a search for a smaller copy. Every run is a dry run unless you say otherwise, and every execution is recorded. The evidence panel is enriched from Radarr/Sonarr and, with a key, TMDB. Still to come: Ombi requester provenance, Prowlarr rarity, season trimming and a leaving-soon collection. ## Install ```bash git clone https://github.com/alewman/plex-reaper.git cd plex-reaper python -m venv .venv && .venv/bin/pip install -e . cp plex-reaper.example.toml plex-reaper.toml # edit Tautulli paths, protections, weights cp .env.example .env # PLEX_TOKEN, RADARR_API_KEY, SONARR_API_KEY, … .venv/bin/plex-reaper check ``` Python 3.12 or newer. The Tautulli databases are read directly and read-only (`mode=ro&immutable=1`), so the files must be readable by the user running the tool. The Plex client only ever issues GET requests. ## Use ```bash plex-reaper libraries # find section ids plex-reaper scan # top 50 candidates as a table plex-reaper scan --json --limit 0 # everything, for scripts plex-reaper tui # review interactively plex-reaper decisions # what the ledger remembers plex-reaper execute # plan: resolve marked titles in Radarr/Sonarr, change nothing plex-reaper execute --no-dry-run # act, after a confirmation prompt (--yes skips it) plex-reaper execute --only downgrade --limit 10 # waves, largest first, so re-downloads do not flood the client plex-reaper executions # what has actually been done plex-reaper export reap-list.json # marked items as JSON, for scripts # bulk quality policy plex-reaper retarget --arr sonarr --from "SD to 2160p Web Max" --to "SD to 1080p Web Max" # profile only, files untouched plex-reaper mark-4k --arr sonarr --ended-only --min-gb 20 # list ended shows holding 4K; --no-dry-run marks them 'downgrade' ``` The Plex inventory is cached (12 hours by default); `--refresh` forces a new pull. Tautulli is re-read on every run because it is local and fast. ### The TUI | Key | Action | | --- | --- | | `space` | mark / unmark for reaping | | `k` | keep (hidden from future lists; `h` shows them) | | `d` | mark for downgrade (phase 2 acts on it) | | `p` | protect | | `u` | clear the decision | | `/` | filter by title, library or genre | | `s` | cycle sort: score, size, age, title | | `x` | review marked items: plans them against Radarr/Sonarr; `X` executes after a y/n confirm; `e` exports JSON | | `q` | quit | Decisions are written to the ledger the moment you press the key. ## How the score works Positive signals argue for removal, negative ones for keeping. Defaults: | Code | Meaning | Points | | --- | --- | --- | | `NEVER` | no genuine watch on any server, no Plex history | +30 | | `GHOST` | only sub-15% sessions ever | +5 | | `ABANDON` | each non-admin session that bailed (cap 3) | +8 | | `AGE` | 1 to 4 years in the library | +0 to +15 | | `SIZE` | 1 GB to 100 GB, log scale | +0 to +15 | | `BLOAT` | more than 8 GB per hour of runtime; flags *downgrade* | +5 | | `LOWRATE` | audience rating ≤ 5.0 / ≤ 3.0 | +5 / +10 | | `STALLED` | show nobody got past season 1 of; flags *trim* | +10 | | `WATCHED` | genuine watches, more users count more | −40 to −70 | | `RECENT` | watched in the last year | −20 | | `PRIOR` | Plex history only | −25 | | `SIBLING` | a title in the same collection was watched | −15 | | `PROTECTED` | genre, title pattern or library rule | score 0 | All weights are in `plex-reaper.toml`. ## Execution and safety - Plex is never written to. Tautulli is opened read-only. All changes go through the Radarr/Sonarr v3 API, and only `sources/arr.py` can make them. - `reap`: unmonitor, then delete each file through `moviefile` / `episodefile`. The movie or series entry is kept, so a user can re-request it through Ombi or Overseerr and it will be grabbed again. - `downgrade`: switch to the profile mapped in `[arr.downgrade]` for the title's current profile (unmapped profiles are refused), keep the item monitored, delete only the files above the new profile's highest allowed resolution, then post a search. Files already at or below it stay. Radarr and Sonarr will not replace a file with a lower quality on their own, so the oversized files have to go first. Until the search lands those episodes are missing; if nothing is found they stay wanted. - `retarget`: bulk profile change through the `*arr` editor endpoint. No files are touched; it only changes what future grabs look like. Dry run by default. - `mark-4k`: measures files above 1080p per title and writes `downgrade` decisions for the ones over a size floor, so they flow through the normal `execute` plan, confirmation and record. Dry run by default. - Planning resolves each marked title by TMDB, TVDB or IMDB id from Plex, then by title and year, and refuses anything protected, unresolved, without files, or in a library no instance owns. The plan is shown before anything runs. - `execute` is a dry run by default. `--no-dry-run` asks for confirmation. In the TUI, `X` on the review screen asks y/n. Each action is recorded in the ledger's `executions` table with the arr ids and file paths, and a successful one clears the decision. A failed one keeps it, so you can retry. ## Development ```bash .venv/bin/pip install -e '.[dev]' .venv/bin/pytest -q .venv/bin/ruff check plexreaper tests ``` ## License [MIT](LICENSE)