Import pipeline: probe, hardlink, rename, layout (#82)
ci / rust (push) Failing after 1m43s
ci / web (push) Successful in 58s
e2e / e2e (push) Successful in 1m25s

This commit was merged in pull request #82.
This commit is contained in:
2026-08-22 23:21:30 +01:00
parent 62aba6315c
commit ffb8485939
18 changed files with 1653 additions and 20 deletions
+21
View File
@@ -332,6 +332,27 @@ pub fn parse(name: &str) -> NameClaims {
claims
}
/// Collapse a release name to the blacklist key (`DESIGN.md` §6.3): lowercase,
/// every run of non-alphanumerics as one dot. The same release reappearing
/// with different separators or a different infohash still matches.
#[must_use]
pub fn normalise(name: &str) -> String {
let mut out = String::with_capacity(name.len());
let mut pending_gap = false;
for character in name.chars() {
if character.is_alphanumeric() {
if pending_gap && !out.is_empty() {
out.push('.');
}
pending_gap = false;
out.extend(character.to_lowercase());
} else {
pending_gap = true;
}
}
out
}
fn apply_marker(claims: &mut NameClaims, sources: &mut Vec<Source>, m: Marker) {
match m {
Marker::Resolution(r) => {
+12
View File
@@ -423,3 +423,15 @@ fn non_tv_names_claim_no_episode() {
assert_eq!(parse(name).episode, None, "{name}");
}
}
#[test]
fn normalisation_is_separator_and_case_blind() {
let key = arr_parse::normalise("Dune.Part.Two.2024.2160p.WEB-DL.DDP5.1.Atmos");
assert_eq!(key, "dune.part.two.2024.2160p.web.dl.ddp5.1.atmos");
assert_eq!(
arr_parse::normalise("dune part two [2024] 2160p WEB DL DDP5 1 atmos "),
key,
"the same release under different separators is the same blacklist key"
);
assert_eq!(arr_parse::normalise("!!!"), "");
}