refactor(tmdb): split enrichment services, extract Stalker season overlay, cap PWA cache

Follow-up to #1123 addressing the remaining greptile style notes:

- TmdbEnrichmentService (319 lines) is now a movie/TV resolver facade
  (227): person and season lookups moved to focused TmdbPersonService and
  TmdbSeasonService, and the shared opt-in gate / API key / language
  resolution lives in TmdbRuntimeService instead of being duplicated.
  Public API is unchanged — the facade delegates.
- Stalker series view sheds its TMDB season-overlay state and lazy fetch
  into the component-provided StalkerSeriesTmdbSeasonsService
  (912 -> 863 lines).
- The PWA in-memory TMDB cache is now a proper LRU capped at 300 entries
  (get() refreshes recency, set() evicts the oldest) instead of growing
  unboundedly for the session.

Docs updated (module table in tmdb-metadata-enrichment.md). New spec:
tmdb-cache.service.spec.ts covering the LRU behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Fable 5 committed 2026-07-04 17:15:00 +02:00
1 parent dc05a2566e
commit 1f86ec3342
10 files changed
+376 -188

No files matched your search

@@ -40,9 +40,12 @@ store imports):
| `tmdb.types.ts` | TMDB v3 response shapes (search, details with credits) |
| `tmdb-api.service.ts` | Thin `fetch`-based client (TMDB supports CORS; works in Electron renderer and PWA). Accepts v3 keys (`api_key` param) and v4 tokens (Bearer) |
| `tmdb-matcher.ts` | Title normalization, year extraction, and the match-confidence gate (pure functions) |
| `tmdb-cache.service.ts` | Environment-aware cache (Electron IPC bridge vs in-memory) with caller-supplied TTLs |
| `tmdb-cache.service.ts` | Environment-aware cache (Electron IPC bridge vs in-memory LRU capped at 300 entries) with caller-supplied TTLs |
| `tmdb-merge.ts` | Field-level merge into `XtreamVodInfo` / `XtreamSerieInfo` (pure functions, no mutation) |
| `tmdb-enrichment.service.ts` | Orchestrator: settings gate → id resolution → details fetch → cache |
| `tmdb-runtime.service.ts` | Shared runtime context: opt-in gate, effective API key, language resolution |
| `tmdb-enrichment.service.ts` | Movie/TV orchestrator and facade: id resolution → details fetch → cache; delegates person/season lookups |
| `tmdb-person.service.ts` | Cached person details + combined filmography (`person:<id>` rows) |
| `tmdb-season.service.ts` | Cached lazy per-season episode lists (`id:<id>\|season:<n>` rows) |
Integration glue per portal: