* fix(metadata): re-fetch titles/overviews when a library's metadata language changes
An item's default_metadata_language was stamped once at first match and
never updated: the canonical-language pin in mergeAndPersist routed any
refresh in a different language into the localization tables, the
upserts' COALESCE kept the old stamp forever, quick-mode library refresh
skipped complete items entirely, and changing the language in
HandleUpdateLibrary triggered nothing. Items stayed in the old language
no matter how often the admin refreshed (#211).
Four coupled changes:
- ProcessRequest.AdoptLanguage: folder-scoped manual refreshes adopt the
library's language as the item's new canonical language when it
differs from the stamp, rewriting the base row instead of localizing
to the side. Only ModeManualRefresh adopts — scheduled refreshes merge
fill-empty and would restamp without rewriting the text.
- Upsert language pins inverted (media_items, seasons, episodes): prefer
the incoming non-empty default_metadata_language over the existing
stamp. All existing callers send the unchanged stamp or empty, so
behavior is unchanged outside adoption; the restamp is atomic with the
canonical write.
- Quick-mode refresh lister now includes complete items whose stamp
differs from the library's configured language.
- HandleUpdateLibrary enqueues a quick library metadata refresh when the
metadata language changes, mirroring the paths-change rescan trigger.
Fixes#211
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(metadata): gate language adoption on field locks and library agreement
Two hardening fixes for AdoptLanguage from review of #278:
- Locked fields defeat the restamp: title/overview merges honor per-field
locks, but the restamp was unconditional. An item with both language-
bearing fields locked kept its old-language text yet got stamped the
new language, so the quick-refresh mismatch predicate never flagged it
again. mergeAndPersist now skips adoption when both name and overview
are locked, falling back to the non-adopting behavior: the stamp stays
put, isCanonicalWrite goes false, and the fetch routes to the
localization tables exactly like a non-adopting refresh in that
language does today. One locked field still adopts — the other is
actually rewritten.
- Multi-library flip-flop: an item in libraries with different metadata
languages had its canonical base row rewritten to whichever library
refreshed last, oscillating forever. Process now requires every
library containing the item (media_item_libraries) to resolve to the
adoption target before setting AdoptLanguage, via the existing
GetDistinctMetadataLanguagesForItem (which applies the same empty→en
default as resolveFolderLanguage). Disagreement or a lookup failure
keeps the current stamp — stable beats flip-flopping.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Quick <31828688+Quick104@users.noreply.github.com>