Skip to main content

parse_quality

Function parse_quality 

Source
pub fn parse_quality(name: &str) -> QualityModel
Expand description

Canonical entry-point for parsing a release name into a QualityModel. Ported from QualityParser.cs:68-98 (ParseQuality). Use parse_quality_name only if you need to bypass the extension lookup.

Wraps parse_quality_name with the C# extension fallback at lines 81-95: when the inner cascade returns Quality::Unknown, look up the file extension via [quality_for_extension] and overlay the result. The C# branch sets SourceDetectionSource and ResolutionDetectionSource to Extension BEFORE inspecting the returned Quality (lines 87-88), so even a recognised-but-Unknown extension (e.g. .webm) flips both flags.

C# guards this branch with !name.ContainsInvalidPathChars(). The Rust port mirrors that guard via [contains_invalid_path_chars], which is the Path::GetInvalidPathChars() set: NUL plus the C0 control range \x00-\x1F. Cross-platform, no Windows-only chars (matches the C# behaviour where Path.GetInvalidPathChars excludes the per-platform “additional” chars like <>:"/\?*).