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
+5
View File
@@ -49,6 +49,11 @@ class MetadataProvider(ABC):
async def get_person(self, external_id: str) -> dict[str, Any]:
"""Fetch raw person data, including external IDs and images."""
@abstractmethod
async def get_collection(self, external_id: str) -> dict[str, Any]:
"""Fetch raw collection/franchise data: name, overview, poster/
backdrop, and its member movies (TMDb's "parts")."""
@abstractmethod
async def search_movie(self, query: str) -> list[dict[str, Any]]:
"""Search this provider's catalog for movies matching `query`. Used
+3
View File
@@ -80,6 +80,9 @@ class TMDbProvider(MetadataProvider):
async def get_person(self, external_id: str) -> dict[str, Any]:
return await self._get(f"/person/{external_id}", {"append_to_response": _PERSON_APPEND})
async def get_collection(self, external_id: str) -> dict[str, Any]:
return await self._get(f"/collection/{external_id}")
async def search_movie(self, query: str) -> list[dict[str, Any]]:
data = await self._get("/search/movie", {"query": query})
return data.get("results", [])