From eccd465f8954bfd49c3f7d8f02446bc2aa5c4338 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Sat, 26 Sep 2026 14:28:13 +0200 Subject: fix(node,client): query TMDB only once a language is chosen, in that language MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TMDB fiches are fetched lazily, on browse, and the fetch used to run whatever the moment it was first triggered — routinely before the operator had opened settings and picked a language, so it queried in TMDB's English default. Then the fiche was cached by tmdb_id alone, with no note of language and a 30-day TTL, so switching to the intended language afterwards changed nothing: the English fiche was served until it expired. The operator's only recourse was to find and wipe the cache by hand (found live 2026-09-26: a whole library indexed in English although "Français" had been chosen). Two rules now, both there to make the first fetch the right language rather than English-then-corrected, and to stop the doubled requests that eventually get a node rate-limited: - No language configured, no query. media_meta_req/season_meta_req answer confidence 0 and make no TMDB call while tmdb_language is unset; the fetch waits for the operator's choice, so the first (and only) query is in it. English is now a first-class choice (en-US), not the default of skipping the setting. - Changing the language wipes the metadata cache (ops.set_tmdb_config), so the new language takes effect on an already-browsed library. The file->tmdb matches are language-independent and kept. The client refetches on the tmdb_config_ack that carries the new language, so the grid updates without a page reload. docs/MESHBAY_DESIGN.md §9.7 states both rules; tests cover the gate and the cache wipe, and two existing handler harnesses now declare a language. Co-Authored-By: Claude Opus 4.8 --- docs/MESHBAY_DESIGN.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'docs') diff --git a/docs/MESHBAY_DESIGN.md b/docs/MESHBAY_DESIGN.md index 4daa094..4541d64 100644 --- a/docs/MESHBAY_DESIGN.md +++ b/docs/MESHBAY_DESIGN.md @@ -2615,6 +2615,28 @@ its own bounded pool after a file is first seen: the file appears in the index immediately with size and hash, and an index delta fills in the technical and parsed fields once ready. **No scan is blocked waiting for enrichment.** +**TMDB metadata is queried in one node-wide language, and not until one is chosen.** +A cached fiche is keyed by TMDB id alone — it records no language, because there is +only ever one. Two rules keep it honest, both there to make the very first fetch the +right language rather than English-then-corrected: + +- **No language configured, no query.** While `tmdb_language` is unset the node + answers `media_meta_req`/`season_meta_req` with confidence 0 and makes no TMDB call + — it does *not* fall back to TMDB's English default. Browsing the library is what + triggers the lazy fetch, and it routinely happens before the operator has opened the + settings, so querying on an unset language would fetch the whole library in English + and then throw it all away the moment a language was picked — double the requests + against TMDB's rate limit, for a result nobody wanted. The fetch waits for the + choice, so the first (and only) query is in the chosen language. English is a + first-class choice like any other (`en-US`), not the accidental default of skipping + the setting. +- **Changing the language wipes the cache.** A fiche fetched under the old language + would otherwise be served for its whole 30-day TTL. The file→TMDB matches are + language-independent and survive the wipe; only the localized fiches are dropped and + refetched, lazily, on the next request. The client refetches on its own when the + `tmdb_config_ack` carrying the new language arrives, so the grid switches language + (or fills in for the first time) without a page reload. + ### 9.8 Music An album browser and a player over the audio files in the group's configured -- cgit v1.2.3