Store full TMDB data, add rate limiting and stale-entry refresh

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
This commit is contained in:
X4Lo committed 2026-11-05 11:39:15 +00:00
1 parent cee6f7f961
commit a9ff2d089a
33 files changed
+1722 -483

No files matched your search

+22 -1
View File
@@ -10,7 +10,15 @@
* - Genres come as string arrays from the backend mapper
*/
import type { Entry, Collection, Media, Credit, Genre, DiscoveryVideo } from "@/types";
import type {
Entry,
Collection,
Media,
Credit,
Genre,
Network,
DiscoveryVideo,
} from "@/types";
/* ---------- Media ---------- */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -46,6 +54,18 @@ export function normalizeCredit(raw: any): Credit {
};
}
/* ---------- Network ---------- */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function normalizeNetwork(raw: any): Network {
return {
id: raw.id,
name: raw.name,
origin_country: raw.originCountry ?? raw.origin_country ?? null,
homepage: raw.homepage ?? null,
logo_path: raw.logoPath ?? raw.logo_path ?? null,
};
}
/* ---------- Genre ---------- */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function normalizeGenres(raw: any[]): Genre[] {
@@ -82,6 +102,7 @@ export function normalizeEntry(raw: any): Entry {
collections: raw.collections
? raw.collections.map(normalizeCollection)
: undefined,
networks: raw.networks ? raw.networks.map(normalizeNetwork) : undefined,
// Mark as in library when loaded from the library endpoint
isInLibrary: raw.isInLibrary ?? true,
};