Backend - Route all TMDB requests through a rate limiter (20 req/s, 8 concurrent) with 429/5xx retries; stop logging the API key - Fetch external ids, certification, keywords, videos, watch providers and alternative titles in the entry details request - Shared entry mapper used by create, refresh, season refresh and importer - New columns on entries, ids, ratings, seasons, episodes and people, with an idempotent startup migration (adds missing columns, widens types) - Fix TV IMDb ids, network country/logo, episode tmdb_id on refresh, and genre/network removal on refresh - Add stale-entries maintenance job (count, start, cancel) and live recommendations endpoint Frontend - Entry page: certification, tagline, creators, in-app trailer, vote count, TV/movie details, network logos, external links, keywords, where to watch, and recommendations - Episode page: directors, writers and guest stars - Settings: TMDB refresh card with live progress
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { useEntryRecommendations } from "@/hooks/useEntries";
|
|
import { EntryCard } from "@/components/entries/EntryCard";
|
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
|
|
const GRID =
|
|
"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4 xl:grid-cols-6";
|
|
const MAX_ITEMS = 12;
|
|
|
|
/** "More like this": live TMDB recommendations for a library entry. */
|
|
export function RecommendationsSection({
|
|
entryId,
|
|
isTvSeries,
|
|
}: {
|
|
entryId: number;
|
|
isTvSeries: boolean;
|
|
}) {
|
|
const { data, isLoading, isError } = useEntryRecommendations(entryId);
|
|
|
|
if (isError) return null;
|
|
|
|
const results = (data?.results ?? [])
|
|
.filter((r) => r.poster_path)
|
|
.slice(0, MAX_ITEMS)
|
|
// Recommendations don't always carry media_type; it matches the entry's
|
|
.map((r) => ({
|
|
...r,
|
|
media_type: r.media_type ?? (isTvSeries ? "tv" : "movie"),
|
|
}));
|
|
|
|
if (!isLoading && results.length === 0) return null;
|
|
|
|
return (
|
|
<section className="space-y-3">
|
|
<h3 className="text-lg font-semibold">More like this</h3>
|
|
<div className={GRID}>
|
|
{isLoading
|
|
? Array.from({ length: 6 }).map((_, i) => (
|
|
<Skeleton key={i} className="aspect-2/3 rounded-lg" />
|
|
))
|
|
: results.map((r) => <EntryCard key={r.id} tmdbEntry={r} />)}
|
|
</div>
|
|
</section>
|
|
);
|
|
}
|