The poster-tag tolerance only without a counter
Test and deploy / test (push) Successful in 42s
Test and deploy / edge (push) Successful in 1m43s
Test and deploy / deploy (push) Successful in 1m24s

"[ MacGyver.S01E03.DVDRip.XviD-MEDiEVAL ]-[04/38] - "sample.macgy.s01e03-med.avi""
shares one word with the sample's stem: 6225008 took the name for a tag and
split the episode 17 + 21. A counted subject names its upload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daan MeijerandClaude Opus 5.5 committed 2026-10-12 18:52:26 +02:00
1 parent 62250081ef
commit 0fafe71b21
3 files changed
+16 -10

No files matched your search

+9 -6
View File
@@ -594,7 +594,7 @@ const TAG_WORDS: [&str; 21] = [
];
/// isPosterTag: the text outside the quotes shares no word with the file's stem.
pub fn is_poster_tag(remainder: &str, stem: &str) -> bool {
pub fn is_poster_tag(remainder: &str, stem: &str, counted: bool) -> bool {
let lower = stem.to_lowercase();
let words: Vec<&str> = lower.split(|c: char| !(c.is_ascii_lowercase() || c.is_ascii_digit())).filter(|w| !w.is_empty()).collect();
let compact: String = words.concat();
@@ -621,8 +621,9 @@ pub fn is_poster_tag(remainder: &str, stem: &str) -> bool {
shared += 1;
}
}
// A tag of 4+ words may share one with the stem ("German Board - [Usenet4ever.info] und [SecretUsenet.com]").
shared == 0 || (shared == 1 && significant >= 4)
// Without a counter, a tag of 4+ words may share one with the stem ("German Board - [Usenet4ever.info] und [SecretUsenet.com]").
// With one, that's a name ("[ MacGyver.S01E03.DVDRip.XviD-MEDiEVAL ]-[04/38] - "sample.macgy.s01e03-med.avi"").
shared == 0 || (shared == 1 && significant >= 4 && !counted)
}
/// releaseIdentity for a named (not weak) file: never null.
@@ -697,7 +698,7 @@ pub fn release_identity(poster: &str, subject: &str, name: &str) -> Release {
let hashed = file_total.is_none() && test(&HASHED, &stem);
// A dated stem says which upload it is, short as it is ("09-30-2008_CTC.r00").
let dated = date_led(stem.as_bytes());
let tag = hashed || (!image && !numbered && !test(&AUDIO, name) && (describes(&stem) || dated) && !looks_random(&stem) && is_poster_tag(&remainder, &stem));
let tag = hashed || (!image && !numbered && !test(&AUDIO, name) && (describes(&stem) || dated) && !looks_random(&stem) && is_poster_tag(&remainder, &stem, total.is_some()));
let prefix = if image { image_prefix(&stem) } else { String::new() };
// An image set's subject may be one word, the model's name: /^[A-Za-z]{3,}$/.
let one_word = image && remainder.len() >= 3 && remainder.bytes().all(|c| c.is_ascii_alphabetic());
@@ -1190,8 +1191,8 @@ mod tests {
assert_eq!(ftd1.key, ftd2.key);
let scene = release_identity("p", r#"Some.Movie.2008.DVDRip.XviD-GRP [01/40] - "grp-sm.part01.rar" yEnc"#, "grp-sm.part01.rar");
assert_eq!(scene.name, "Some Movie 2008 DVDRip XviD GRP");
assert!(is_poster_tag("PowBeertje80 Posted", "Bravo Hits Vol.14 2CD -1996-"));
assert!(!is_poster_tag("Audiofiles DIE ZEIT 35", "35_China_dl"));
assert!(is_poster_tag("PowBeertje80 Posted", "Bravo Hits Vol.14 2CD -1996-", false));
assert!(!is_poster_tag("Audiofiles DIE ZEIT 35", "35_China_dl", false));
}
#[test]
@@ -1407,6 +1408,8 @@ mod image_set_tests {
assert_ne!(gb("6c57319fbae505679737bd46a76193a1-u4e.part6.rar").key, gb("6fc0ff192a355703b3e81557893013b1-u4e.part6.rar").key);
assert_ne!(gb("21.Jump.Street.2012.BDRip.AC3.German.XviD-POE.part01.rar").key, gb("Ice.Age.4.Voll.verschoben.2012.BDRip.AC3.German.XviD-POE.part01.rar").key);
assert_eq!(gb("21.Jump.Street.2012.BDRip.AC3.German.XviD-POE.part01.rar").key, gb("21.Jump.Street.2012.BDRip.AC3.German.XviD-POE.par2").key);
let mac = |i: &str, n: &str| release_identity("p", &format!(r#"[1598]-[FULL]-[#a.b.teevee@EFNet]-[ MacGyver.S01E03.DVDRip.XviD-MEDiEVAL ]-[{i}/38] - "{n}" yEnc"#), n);
assert_eq!(mac("04", "sample.macgy.s01e03-med.avi").key, mac("05", "macgy.s01e03-med.r00").key);
let pck = |i: &str, n: &str| release_identity("p", &format!(r#"(????) [{i}/2195] - "{n}" yEnc"#), n);
assert_eq!(pck("0659", "DN.VPL PCK.1508").key, pck("0660", "DN.VPL PCK.1509").key);
assert_eq!(pck("0659", "DN.VPL PCK.1508").name, "DN.VPL PCK.1508");