Add series/season/episode ingestion pipeline
CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s

Movie and person ingestion existed, but the series/season/episode API
endpoints had no way to actually populate them from TMDb -- the
biggest remaining gap in Core 0.1's television scope.

- normalize_series/normalize_season in the metadata normalizer,
  including two TMDb quirks that would otherwise silently produce
  empty data: /tv nests keywords and alternative_titles under
  "results" (not "keywords"/"titles" like /movie), and series-level
  creators come from a separate created_by array, not the credits
  cast/crew lists.
- ingest_series upserts the Series row plus season *stubs* (number,
  title, air date, poster -- everything TMDb inlines on /tv/{id});
  ingest_season fetches and upserts one season's full episode list,
  and requires the series to already exist (TMDb has no single
  endpoint for a whole series' episodes, so this has to be a separate
  per-season call).
- Wired through the same job-lifecycle path as movie/person ingestion
  (runner.py, arq tasks, admin endpoints), with the shared boilerplate
  between them factored into runner._run_ingestion and
  admin.py:_enqueue rather than copy-pasted a third and fourth time.
- Unit tests for both normalizers (runnable without a DB) and
  integration tests for the full ingest_series -> ingest_season flow,
  including the series-must-exist-first error and idempotency on
  re-ingestion.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
NixReaper
2026-09-04 19:43:56 -05:00
co-authored by Claude Sonnet 5
parent 669034896a
commit 3f6332559a
11 changed files with 1288 additions and 49 deletions
+11
View File
@@ -163,3 +163,14 @@ indexes on the alternate-title tables. See
links) are replaced wholesale on each re-sync rather than diffed, so their
Aurora IDs are not stable across re-ingestion — see
`app/services/ingestion/movie_ingestion.py`.
- Seasons don't get their own `external_ids` row (identified instead by the
natural `(series_id, season_number)` key) — episodes do, since TMDb gives
each episode a distinct global id. Revisit if a provider ever needs a
season-level external reference Aurora doesn't already have another way
to resolve.
- `ingest_series` only upserts season *stubs* (number, title, air date,
poster) — episodes require a separate `ingest_season` call per season
(TMDb has no single endpoint returning a whole series' episodes), and
that call requires the series to already exist. There's no orchestration
yet that walks all of a series' seasons automatically after
`ingest_series` succeeds.