feat(api): series, season and episode endpoints #81
Merged
naps62-yolo
merged 2 commits from 2026-08-22 23:02:35 +01:00
issue/39-series-api into main
Labels
Clear labels
area/api
area/ci
area/compat
area/core
area/daemon
area/db
area/dl
area/indexer
area/infra
area/meta
area/parse
area/probe
area/subs
area/web
difficulty/easy
difficulty/hard
difficulty/moderate
difficulty/trivial
phase/1-skeleton
phase/2-logic
phase/3-sourcing
phase/4-movies
phase/5-ui
phase/6-tv
phase/7-people
phase/8-compat
phase/9-subtitles
type/bug
type/chore
type/feature
type/test
arr-api
CI and test harness
arr-compat
arr-core
arr-daemon
arr-db
arr-dl
arr-indexer
workspace and tooling
arr-meta
arr-parse
arr-probe
arr-subs crate: providers, extraction, translation, sync
web/
bounded, obvious approach, few files
subtle correctness or cross-cutting
multiple files, judgement, an interface to design
one file, mechanical, no design decisions
workspace, CI, config, database, empty API and SPA
parsing and policy engine, pure, no network
TMDB and Prowlarr, read-only
movies end to end
search, buckets, library views, queues
seasons, episodes, tracking, derived status
owner tags and notifications
Jellyseerr shim
build order: subtitles, DESIGN.md §15
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: yolo/arr#81
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Implements the API half of #39. The UI half is left out — see below.
Adds the series equivalents of the movie endpoints, plus season and
episode granularity:
/api/seriesCRUD, each response carrying a status derived from itsepisodes (§4.2) rather than a stored column.
/api/series/{id}/seasons— read, and create the season a metadatarefresh reveals. Creation runs
arr_core::tracking::apply_auto_trackinstead of taking
wantedfrom the request, so the §4.1 rule stays inone place.
PATCHon a season setstrackedandwantedindependently:trackedis the rule for episodes not yet revealed,wantedis theone-click season grab written onto the episodes already there.
PATCH /api/episodes/{id}sets the only intent the aggregate carries./api/episodes/{id}/search,/releasesand/releases/{id}/grab,plus owner tags on series.
GET /api/releasesnow takesmovie_idorepisode_id; passingboth or neither is a 422.
Two things worth knowing:
arr-db'sMoviePolicyis nowTitlePolicy, withMoviePolicykept asan alias so
arr-daemonis untouched. Episodes needed the same loaderand the old name had become a lie.
The series table has no TVDB ID, so an episode search cannot use
t=tvsearch&tvdbid=;tv_requestfalls back to a text search carryingthe
SxxEyytag. That is the documented fallback (§6.1), but ID searchstays unavailable until TV metadata refresh lands and can populate one.
The UI is not in this PR. The issue says the UI reuses the phase 5
components — buckets, chips, derived status. Those are #31, #32 and #33,
all still open, so there is nothing to reuse yet and building them here
would be implementing three other issues inline. Series views should
follow once they land.
Verification
just cigreen locally: fmt, clippy-D warnings, machete, 208 tests,biome and tsc.
New tests cover auto_track deciding whether a revealed season arrives
wanted, season versus single-episode intent, the derived status changing
as an episode is imported, blocked stopping episode search, grab scoping
to the episode's own releases, owner filtering, cascade on delete, and
the episode manual search reaching the indexer as
q=Bluey S01E02.@@ -0,0 +613,4 @@apply_auto_track(&core_series(&series), &mut revealed);let [revealed] = revealed;let season_id = sqlx::query!(Creating the season and its episodes is not atomic. Duplicate episode numbers insert the season and earlier episodes before the unique constraint returns 500, so a retry cannot create the intended season. Validate duplicates before writing or use a transaction.
Fixed in
2e14e0b. Duplicate episode numbers are now a 422 checked beforeanything is written, and the season plus its episodes insert inside one
transaction, so a rejected request leaves the season number free for the
retry.
Test covers it: the duplicate body is rejected,
seasonsis still emptyafterwards, and the corrected retry succeeds.
Reviewed
2e14e0b19cfcf2c25baa045d975bdc7a5489bf40. No findings.