fix(parse): pack titles and degenerate ranges

COMPLETE before the season tag was weak junk, so it stayed in
the title and exact-title matching failed silently (#135). It
now closes the boundary wherever it lands.

S01-S01 produced no claim because the dash-range branch required
last > season; a degenerate range is one season's pack, matching
the rule match_episode lifted.
This commit is contained in:
Miguel Palhas
2026-08-23 18:02:39 +01:00
parent 384e260d72
commit 8d79c7c378
4 changed files with 74 additions and 9 deletions
+31 -3
View File
@@ -621,6 +621,10 @@ mod tests {
"Fallout.S01.1080p.BluRay.x264-GROUP",
MatchShape::SeasonPack,
),
(
"Fallout.S01-S01.1080p.BluRay.x264-GROUP",
MatchShape::SeasonPack,
),
];
for (name, shape) in cases {
assert_eq!(
@@ -639,6 +643,32 @@ mod tests {
}
}
/// `COMPLETE` before the season tag used to stay in the title and
/// break the exact-title comparison (#135).
#[test]
fn a_pack_marker_before_the_tag_still_matches() {
let wanted = WantedEpisode {
id: EpisodeId(10),
tmdb_id: None,
imdb_id: None,
title: "Bluey".to_owned(),
season: 1,
episode: 3,
};
assert_eq!(
match_episode(
&wanted,
&ReleaseIds::default(),
&arr_parse::parse("Bluey.COMPLETE.S01.1080p.WEB-DL-GROUP"),
),
Some(EpisodeMatch {
episode: EpisodeId(10),
kind: MatchKind::TitleAndYear,
shape: MatchShape::SeasonPack,
})
);
}
/// Punctuation, case and accents in the series title do not block the
/// match.
#[test]
@@ -808,9 +838,7 @@ mod tests {
}
}
/// `S01-S01` does not parse as a claim (`arr-parse` takes only a real
/// range), but the lifted rule is what a degenerate range would mean:
/// one season's pack, not a multi-season one.
/// A degenerate range means one season's pack, not a multi-season one.
#[test]
fn a_degenerate_season_range_is_this_seasons_pack() {
use super::{is_single_episode, is_this_seasons_pack};