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
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:
co-authored by
Claude Sonnet 5
parent
74ebad379a
commit
6c95e18aad
@@ -19,8 +19,10 @@ from app.schemas.movie import (
|
||||
MovieRecommendationsOut,
|
||||
MovieSummaryOut,
|
||||
MovieVideosOut,
|
||||
MovieWatchProvidersOut,
|
||||
)
|
||||
from app.services.common import (
|
||||
build_watch_providers_out,
|
||||
pick_certification,
|
||||
primary_artwork_path,
|
||||
split_credits,
|
||||
@@ -60,6 +62,7 @@ async def get_movie_detail(session: AsyncSession, movie_aurora_id: str) -> Movie
|
||||
artwork = await polymorphic.get_artwork(session, "movie", movie_id)
|
||||
videos = await polymorphic.get_videos(session, "movie", movie_id)
|
||||
release_dates = await polymorphic.get_release_dates(session, "movie", movie_id)
|
||||
watch_provider_rows = await polymorphic.get_watch_providers(session, "movie", movie_id)
|
||||
external_ids = await polymorphic.get_external_ids(session, "movie", movie_id)
|
||||
|
||||
cast, crew = split_credits(credits_)
|
||||
@@ -114,6 +117,7 @@ async def get_movie_detail(session: AsyncSession, movie_aurora_id: str) -> Movie
|
||||
images=to_images_out(artwork),
|
||||
videos=[to_video_out(v) for v in videos],
|
||||
release_dates=[to_release_date_out(rd) for rd in release_dates],
|
||||
watch_providers=await build_watch_providers_out(session, watch_provider_rows),
|
||||
external_ids=external_ids,
|
||||
created_at=movie.created_at,
|
||||
updated_at=movie.updated_at,
|
||||
@@ -148,6 +152,19 @@ async def get_movie_videos(session: AsyncSession, movie_aurora_id: str) -> Movie
|
||||
return MovieVideosOut(id=aurora_id("movie", str(movie.id)), videos=[to_video_out(v) for v in videos])
|
||||
|
||||
|
||||
async def get_movie_watch_providers(
|
||||
session: AsyncSession, movie_aurora_id: str
|
||||
) -> MovieWatchProvidersOut:
|
||||
movie_id = await _resolve_movie_id(movie_aurora_id)
|
||||
movie = await movie_repository.get_movie_by_id(session, movie_id)
|
||||
if movie is None:
|
||||
raise MovieNotFoundError(movie_aurora_id)
|
||||
rows = await polymorphic.get_watch_providers(session, "movie", movie_id)
|
||||
return MovieWatchProvidersOut(
|
||||
id=aurora_id("movie", str(movie.id)), results=await build_watch_providers_out(session, rows)
|
||||
)
|
||||
|
||||
|
||||
async def get_movie_recommendations(
|
||||
session: AsyncSession, movie_aurora_id: str
|
||||
) -> MovieRecommendationsOut:
|
||||
|
||||
Reference in New Issue
Block a user