Add collection/franchise ingestion
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

Collections were bare stubs (name only) lazily created the moment a
movie's belongs_to_collection reference was seen. Adds a real
ingest_collection pipeline: TMDb's /collection/{id} for overview and
poster/backdrop artwork, plus ordered CollectionMovie membership --
linking only movies already ingested into Aurora, the same
never-fabricate-a-stub rule movie recommendations already follow.

get_or_create_collection now refreshes name/overview on an existing
stub instead of only creating, guarded so a bare movie-stub call
(overview=None) never clobbers real data a full ingestion already
filled in.

New POST /api/v1/admin/ingest/collection endpoint and
ingest_collection_task; GET /api/v1/collections/{id} needed no changes
since its read path (collection_service.py) already assembled the full
detail shape.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
NixReaper
2026-09-05 08:37:27 -05:00
co-authored by Claude Sonnet 5
parent 4af4ba40ef
commit 892f78016c
15 changed files with 460 additions and 1 deletions
+7
View File
@@ -28,6 +28,7 @@ from app.services.ingestion.runner import (
get_series_company_ids,
get_series_season_ids,
get_series_season_numbers,
run_collection_ingestion,
run_movie_ingestion,
run_person_ingestion,
run_season_ingestion,
@@ -102,6 +103,12 @@ async def ingest_season_task(
return str(season_id)
async def ingest_collection_task(ctx: dict[str, Any], job_id: str, external_id: str) -> str:
collection_id = await run_collection_ingestion(uuid.UUID(job_id), external_id)
await _cascade_artwork_downloads(ctx, "collection", [collection_id])
return str(collection_id)
async def download_artwork_task(ctx: dict[str, Any], artwork_id: str) -> bool:
async with session_scope() as session:
return await download_artwork(session, get_artwork_storage(), uuid.UUID(artwork_id))
+2
View File
@@ -15,6 +15,7 @@ from app.core.config import get_settings
from app.core.logging import configure_logging, get_logger
from app.workers.tasks import (
download_artwork_task,
ingest_collection_task,
ingest_movie_task,
ingest_person_task,
ingest_season_task,
@@ -39,6 +40,7 @@ class WorkerSettings:
ingest_person_task,
ingest_series_task,
ingest_season_task,
ingest_collection_task,
download_artwork_task,
]
on_startup = startup