Add watch providers (where to stream/rent/buy)
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

New TMDb integration end to end: append_to_response "watch/providers",
normalizer parsing grouped by country/monetization type, a WatchProvider
catalog entry (external-id keyed, same get_or_create pattern as Company/
Collection/Person) + polymorphic WatchProviderOffering table (new
migration 0002), ingestion write (including provider logos via the
existing Artwork table), and API exposure -- embedded on movie/series
detail plus a dedicated /watch-providers sub-route, shaped to mirror
TMDb's own response for easy porting.

Note: this data comes from JustWatch via TMDb and carries its own
attribution requirement separate from TMDb's general one -- flagged in
docs/api.md, must be satisfied before showing this in the frontend.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
NixReaper
2026-09-06 04:59:02 -05:00
co-authored by Claude Sonnet 5
parent 74ebad379a
commit 6c95e18aad
21 changed files with 767 additions and 2 deletions
+17
View File
@@ -271,6 +271,23 @@ async def ingest_movie(
await polymorphic.sync_release_dates(
session, entity_type="movie", entity_id=movie.id, release_dates=normalized.release_dates
)
touched_watch_providers = await polymorphic.sync_watch_providers(
session,
entity_type="movie",
entity_id=movie.id,
tmdb_provider_id=tmdb_provider.id,
offerings=normalized.watch_providers,
)
for watch_provider, logo_path in touched_watch_providers:
logo = company_logo_artwork(logo_path)
if logo is not None:
await polymorphic.sync_artwork(
session,
entity_type="watch_provider",
entity_id=watch_provider.id,
provider_id=tmdb_provider.id,
artwork_list=[logo],
)
await _link_external_ids(session, movie.id, tmdb_provider.id, normalized)
await session.execute(
@@ -266,6 +266,23 @@ async def ingest_series(
await polymorphic.sync_release_dates(
session, entity_type="series", entity_id=series.id, release_dates=normalized.release_dates
)
touched_watch_providers = await polymorphic.sync_watch_providers(
session,
entity_type="series",
entity_id=series.id,
tmdb_provider_id=tmdb_provider.id,
offerings=normalized.watch_providers,
)
for watch_provider, logo_path in touched_watch_providers:
logo = company_logo_artwork(logo_path)
if logo is not None:
await polymorphic.sync_artwork(
session,
entity_type="watch_provider",
entity_id=watch_provider.id,
provider_id=tmdb_provider.id,
artwork_list=[logo],
)
for stub in normalized.seasons:
season = await tv_repository.get_or_create_season(session, series.id, stub.season_number)