Names: stray quotes, single quotes, hosts, bracketed names; dates, repeats
From the first corpus sweep (183 ranges):
- A stray quote took the last quote pair ('"x.mp3" "Album_BY_WaRLoRD',
'"x.nfo" " yEnc', '"x.nzb" yEnc"'): the last quoted part with an
extension is the name. Each file was a release of its own.
- A single-quoted name at the end ("… [001/106] 'You, Me And Dupree.nfo'"),
not the host before it (www.x2l.nl).
- Text ending in a host ("… www.libranews.nl") is no file name; a name in
brackets comes first ("[01/77][LIBRATEAM_M2219009.par2]",
"-^-[Mnozil Brass - Seven.nzb]-^-").
- A leading date is no item number ("09-30-2008_BAK_JRS.r00": a daily
show's 32,621 files were one release under the poster's tag).
- The file name repeated elsewhere in the subject goes too
("(NELET11.par2) [01/58] - "NELET11.par2"").
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
885e4e6541
commit
1a5035d988
6 files changed
+115
-11
No files matched your search
+27
-5
@@ -641,14 +641,16 @@ pub fn release_identity(poster: &str, subject: &str, name: &str) -> Release {
|
||||
// The subject here has its spaces collapsed; the name may not.
|
||||
// Other quoted text stays: it names the release (">>> CREATIVE COMMONS NZB <<< "0190 alarm 5.0 " - File 1 of 9: …").
|
||||
let quoted = format!("\"{name}\"");
|
||||
let named = if subject.contains("ed) {
|
||||
subject.replacen("ed, " ", 1).replace('"', " ")
|
||||
let without = if subject.contains("ed) {
|
||||
subject.replacen("ed, " ", 1)
|
||||
} else {
|
||||
let collapsed = js::collapse_spaces(name);
|
||||
let collapsed = js::trim(&collapsed);
|
||||
let without = if subject.contains(name) { subject.replacen(name, " ", 1) } else { subject.replacen(collapsed, " ", 1) };
|
||||
without.replace('"', " ")
|
||||
if subject.contains(name) { subject.replacen(name, " ", 1) } else { subject.replacen(collapsed, " ", 1) }
|
||||
};
|
||||
// The name repeated elsewhere ("(NELET11.par2) [01/58] - "NELET11.par2"").
|
||||
let without = if name.encode_utf16().count() >= 5 { without.replace(name, " ") } else { without };
|
||||
let named = without.replace('"', " ");
|
||||
let remainder = subject_remainder(&named);
|
||||
// Counted without the file name: "shyla-shy-09-0195.jpg hardcore …" is no "9 of 195".
|
||||
let total = counter_total(&named);
|
||||
@@ -672,7 +674,16 @@ pub fn release_identity(poster: &str, subject: &str, name: &str) -> Release {
|
||||
let letters = b.iter().take_while(|c| c.is_ascii_uppercase()).count();
|
||||
let code_digits = b[letters..].iter().take_while(|c| c.is_ascii_digit()).count();
|
||||
let code = (1..=5).contains(&letters) && (2..=6).contains(&code_digits) && matches!(b.get(letters + code_digits), Some(b'-' | b'_' | b' '));
|
||||
index_at(0) || (code && index_at(letters + code_digits + 1))
|
||||
// Not a date: /^\d{1,2}[-._]\d{1,2}[-._](?:19|20)\d{2}(?!\d)/ ("09-30-2008_BAK_JRS").
|
||||
let date = {
|
||||
let run = |at: usize| b.get(at..).map_or(0, |s| s.iter().take_while(|c| c.is_ascii_digit()).count());
|
||||
let sep = |at: usize| matches!(b.get(at), Some(b'-' | b'.' | b'_'));
|
||||
let d1 = run(0);
|
||||
let d2 = if (1..=2).contains(&d1) && sep(d1) { run(d1 + 1) } else { 0 };
|
||||
let y = d1 + 1 + d2 + 1;
|
||||
(1..=2).contains(&d2) && sep(d1 + 1 + d2) && run(y) == 4 && matches!(&b[y..y + 2], b"19" | b"20")
|
||||
};
|
||||
(index_at(0) || (code && index_at(letters + code_digits + 1))) && !date
|
||||
};
|
||||
// A hashed stem under text without a counter is the upload, the text a tag ("Seit 1753 Tagen - usenet4ever.info - …").
|
||||
let hashed = file_total.is_none() && test(&HASHED, &stem);
|
||||
@@ -1272,6 +1283,17 @@ mod image_set_tests {
|
||||
assert_ne!(vlad("185", 77, "P8250001.JPG").key, vlad("234", 77, "P5300085.JPG").key);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dates_lead_no_numbered_items_and_repeated_names_go() {
|
||||
let show = |n: &str| release_identity("#sterntuary <aa@aa.com>", &format!(r#"#sterntuary - Jeff Rense Radio Program - "{n}" yEnc"#), n);
|
||||
assert_eq!(show("09-30-2008_BAK_JRS.nfo").key, show("09-30-2008_BAK_JRS.r00").key);
|
||||
assert_ne!(show("09-30-2008_BAK_JRS.r00").key, show("10-01-2008_BAK_JRS.r00").key);
|
||||
let nelet = |n: &str, i: u32| release_identity("p", &format!(r#"({n}) [{i:02}/58] - "{n}" yEnc"#), n);
|
||||
assert_eq!(nelet("NELET11.par2", 1).key, nelet("NELET11.part01.rar", 2).key);
|
||||
let wl = |n: &str| release_identity("p", &format!(r#"(01/26) "{n}" "Silicon Dream - Time Machine_BY_WaRLoRD```` yEnc"#), n);
|
||||
assert_eq!(wl("01 Time Machine.mp3").key, wl("02 Jimmy Dean Loved Marilyn.mp3").key);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hashed_stems_volume_numbers_and_scene_tracks() {
|
||||
let u4e = |n: &str| release_identity("p", &format!(r#"Seit 1753 Tagen - usenet4ever.info - "{n}" yEnc"#), n);
|
||||
|
||||
Reference in new issue
Block a user