align to metadata keys doc

This commit is contained in:
Worph
2026-08-30 19:50:25 +02:00
parent b823654b9a
commit aea258c803
5 changed files with 292 additions and 0 deletions
@@ -178,6 +178,12 @@ fn build_seed_record(
// mode marker, contentKind, and optionally anime.
fields.insert(mode.marker().to_string(), "true".to_string());
fields.insert("contentKind".to_string(), content_kind.to_string());
// The routing axis, co-written with the kind it derives from
// (METADATA_KEYS.md §1): `fileType` says what the bytes are, `domain` says
// which app wants the record.
if let Some(d) = meta_feeder_sdk::domain::domain_for_content_kind(content_kind) {
fields.insert("domain".to_string(), d.to_string());
}
fields.insert("fileType".to_string(), "video".to_string());
if anime {
fields.insert("anime".to_string(), "true".to_string());
@@ -548,6 +548,7 @@ fn build_stub_patch(f: &BTreeMap<String, String>) -> Option<EnrichOutcome> {
set.insert("fileType".to_string(), "video".to_string());
set.insert("videoType".to_string(), "movie".to_string());
set.insert("contentKind".to_string(), "movie".to_string());
set.insert("domain".to_string(), "film".to_string());
}
if !has_poster {
// Non-resolvable marker — the image 404s (broken tile), but the card
@@ -773,6 +774,10 @@ async fn build_enrichment_patch(
match matched_kind {
TmdbKind::Movie => {
set.insert("contentKind".to_string(), "movie".to_string());
// The routing axis moves with the kind: a TMDB movie match is
// `domain=film`, and reconciling the kind without the domain would
// leave the record routed as a series.
set.insert("domain".to_string(), "film".to_string());
// Co-write the narrower `videoType` facet (METADATA_KEYS.md §14.11
// — contentKind=movie ↔ videoType=movie). Overwrites any
// category-derived videoType from `into_discovery_record` with the
@@ -784,6 +789,7 @@ async fn build_enrichment_patch(
}
TmdbKind::Tv => {
set.insert("contentKind".to_string(), "episode".to_string());
set.insert("domain".to_string(), "tv".to_string());
// contentKind=episode ↔ videoType=tvshow (METADATA_KEYS.md §14.11).
set.insert("videoType".to_string(), "tvshow".to_string());
// Season/episode boundary validation. Only a parsed `season`
@@ -530,6 +530,9 @@ impl TriblerPlugin {
"movie"
};
rec.fields.insert("contentKind".to_string(), kind.to_string());
if let Some(d) = meta_feeder_sdk::domain::domain_for_content_kind(kind) {
rec.fields.insert("domain".to_string(), d.to_string());
}
}
// For episode records, stamp the *parsed* season/episode so the consumer
// renders a proper series with an ordered episode list (meta-watch keys
@@ -646,6 +649,7 @@ impl TriblerPlugin {
// resolves the show as TV (the show title drives the TMDB search).
r.fields
.insert("contentKind".to_string(), "episode".to_string());
r.fields.insert("domain".to_string(), "tv".to_string());
}
r
};