pub fn parse_quality_name(name: &str) -> QualityModelExpand description
Quality-cascade entry-point. Ported from QualityParser.cs:100-598
(ParseQualityName).
Duties.
-
Normalise:
name.Replace('_', ' ').Trim()andname.Trim()for the raw side, mirroring C#’s twinTrim()calls atQualityParser.cs:77andQualityParser.cs:102. -
Run
parse_quality_modifiersagainst both raw and normalised name to populateRevision. Modifiers that fire also setrevision_detection_source = Name. -
RawHD short-circuit (C# line 105): return
Quality::RawHdwithsource_detection_source = resolution_detection_source = Name. -
Source-to-quality cascade (C# lines 114-318): take the LAST source match, pair with the parsed resolution + codec + remux signals, and route to a concrete
Qualityvariant. Branches:bluray: codec(xvid|divx) -> 480p, else by-resolution (2160 / 1080 / 576 / {360, 480, 540}); remux+resolution!=720 -> 1080pRemux; else 720p.webdl: by-resolution (2160 / 1080 / 720); raw-name[WEBDL]-> 720p; else 480p.webrip: by-resolution (2160 / 1080 / 720); else 480p.hdtv: MPEG2 -> RawHD; else by-resolution; raw-name[HDTV]-> 720p; else SDTV.bdrip/brrip: by-resolution (720 / 1080 / 2160); else 480p.dvd: DVD always.pdtv/sdtv/dsr/tvrip: 1080p match -> Hdtv1080p; 720p match -> Hdtv720p; HighDefPdtv (hr-ws) -> Hdtv720p; else SDTV.
Provenance flags (
source_detection_source,resolution_detection_source) are populated according to the C# rules:source_detection_sourceis set toNamewhenever a sourceMatch fires;resolution_detection_sourceis set toNamewhen the resolution-regex hit (line 122) or, in the pdtv-cluster branch, when theContainsIgnoreCasesubstring fallback fires (line 308’sHighDefPdtvRegexpath).
Fallthrough cascade (T8). When no source match fires, the following fallbacks run in C# order, each returning on a hit:
- Sourceless remux (C# 320-347):
remuxMatch && resolution != Unknown, dispatched per resolution. SourceDetectionSource is explicitlyUnknownhere per C# line 322. - Anime-bluray (C# 349-390):
AnimeBlurayRegexhits, resolution-routed (480/1080/2160/720 defaults). 480p in this branch maps toQuality::Dvdper C# line 359. - Anime-webdl (C# 392-424):
AnimeWebDlRegexhits, resolution-routed. - Resolution-only (C# 426-497):
resolution != Unknown. Derives aQualitySourcefromremuxMatch(BlurayRaw) OR from the file extension via [quality_for_extension] + [quality_source], then dispatches viafind_by_source_and_resolution. Unknown source falls back to Television-class defaults (Hdtv2160p / Hdtv1080p / Hdtv720p / Sdtv). - x264-SDTV (C# 499-504): bare
x264with no other signal ->Sdtv. - Pixel-tag fallbacks (C# 506-560): literal
848x480,1280x720,1920x1080substrings, optionally combined withdvd/bluraymarkers. - Bare-bluray-resolution (C# 562-587): literal
bluray720p/bluray1080p/bluray2160p->Bluray720p/Bluray1080p/Bluray2160p. OtherSourceMatch(C# 589-595, 653-672):OTHER_SOURCE_REGEXhit (HD-TV/SD-TValternative form) ->Hdtv720p/Sdtv.
Most callers want parse_quality instead. That wrapper adds the
extension-fallback behaviour from QualityParser.cs:81-95 on top of
parse_quality_name’s output. Use parse_quality_name directly only
when you specifically want to bypass the extension lookup (e.g.,
text-only parsing, no file path implied). This split mirrors C#’s
ParseQuality (public) vs ParseQualityName (test-seam) shape.