diff --git a/DESIGN.md b/DESIGN.md index a35e8d1..f173df6 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -259,6 +259,15 @@ When none resolve it, tag the track `por-unverified` and surface it. Do not guess. Guessing toward `kids` gives a child a Brazilian dub; guessing toward `main` rejects a Brazilian film's own audio. +**Untagged audio.** A track tagged `und`, or carrying no language at all, says +nothing. On `main`, when no track matches the original language but one is +untagged, it is a soft fail (`audio_language_untagged`): import with a waiver +instead of rejecting. Sloppy tags are common in WEB-DL packs, often on a single +episode, and a hard fail there blacklists the whole pack (§5.7) over a file +that almost always carries the original soundtrack. `kids` is unchanged: its +missing-pt-PT case is already a soft fail, and an untagged track never counts +as pt-PT. + **Sourcing consequence for `kids`.** European Portuguese dubs live almost entirely in streaming WEB-DLs (Disney+, Netflix, Max) and essentially never in BluRay encodes or remuxes. That root biases hard toward WEB-DL sources, and diff --git a/crates/arr-api/src/search.rs b/crates/arr-api/src/search.rs index 065dbad..9735f72 100644 --- a/crates/arr-api/src/search.rs +++ b/crates/arr-api/src/search.rs @@ -947,6 +947,7 @@ fn rule_name(rule: &Rule) -> String { Rule::RequiredAudio => "required_audio".into(), Rule::DubBlacklist(_) => "dub_blacklist".into(), Rule::PortugueseUnverified => "portuguese_unverified".into(), + Rule::AudioLanguageUntagged => "audio_language_untagged".into(), Rule::DolbyVisionProfile(_) => "dolby_vision_profile".into(), Rule::Resolution(_) => "resolution".into(), Rule::Source(_) => "source".into(), diff --git a/crates/arr-core/src/lib.rs b/crates/arr-core/src/lib.rs index f6b20b6..74b66c2 100644 --- a/crates/arr-core/src/lib.rs +++ b/crates/arr-core/src/lib.rs @@ -422,6 +422,9 @@ pub enum Rule { DubBlacklist(Language), /// A Portuguese track whose pt-PT / pt-BR flavour no signal resolved. PortugueseUnverified, + /// An audio track tagged `und` (or untagged) where none matched the + /// original language: probably the original, but nothing says so. + AudioLanguageUntagged, DolbyVisionProfile(DolbyVisionProfile), Resolution(Resolution), Source(Source), @@ -438,6 +441,7 @@ impl Rule { Self::RequiredAudio => "required_audio".into(), Self::DubBlacklist(_) => "dub_blacklist".into(), Self::PortugueseUnverified => "portuguese_unverified".into(), + Self::AudioLanguageUntagged => "audio_language_untagged".into(), Self::DolbyVisionProfile(_) => "dolby_vision_profile".into(), Self::Resolution(_) => "resolution".into(), Self::Source(_) => "source".into(), diff --git a/crates/arr-core/src/policy.rs b/crates/arr-core/src/policy.rs index bfc2836..40f5bdd 100644 --- a/crates/arr-core/src/policy.rs +++ b/crates/arr-core/src/policy.rs @@ -470,6 +470,13 @@ impl PolicyRule for RequiredAudioRule { if context.overrides.allow_english_audio && languages.contains(&english) { return RuleEvaluation::SoftFail(Rule::RequiredAudio); } + if matches!( + context.policy.required_audio, + RequiredAudio::OriginalLanguage + ) && languages.contains(&Language::Other("und".to_owned())) + { + return RuleEvaluation::SoftFail(Rule::AudioLanguageUntagged); + } Self::failure(context) } } @@ -1242,6 +1249,33 @@ mod tests { ); } + #[test] + fn main_untagged_audio_is_waived_not_rejected() { + let media = probed_audio(vec![track(Language::Other("und".to_owned()))]); + assert_eq!( + verdict_for(&policy(), &en(), Candidate::PostDownload(&media)), + Verdict::Waived(Rule::AudioLanguageUntagged) + ); + } + + #[test] + fn main_untagged_audio_beside_the_original_stays_eligible() { + let media = probed_audio(vec![track(en()), track(Language::Other("und".to_owned()))]); + assert_eq!( + verdict_for(&policy(), &en(), Candidate::PostDownload(&media)), + Verdict::Eligible + ); + } + + #[test] + fn kids_untagged_audio_keeps_the_required_audio_waiver() { + let media = probed_audio(vec![track(Language::Other("und".to_owned()))]); + assert_eq!( + verdict_for(&kids_policy(), &en(), Candidate::PostDownload(&media)), + Verdict::Waived(Rule::RequiredAudio) + ); + } + // §5.2 truth table, `kids` root: require pt-PT, or the original language // when that is already Portuguese; pt-BR never satisfies the requirement. diff --git a/web/src/releases.ts b/web/src/releases.ts index 7a1eae9..8943748 100644 --- a/web/src/releases.ts +++ b/web/src/releases.ts @@ -463,6 +463,7 @@ const RULE_LABEL: Record = { required_audio: "audio", dub_blacklist: "dub", portuguese_unverified: "pt unverified", + audio_language_untagged: "audio untagged", dolby_vision_profile: "dv profile", resolution: "resolution", source: "source",