A date alone isn't an unquoted name; an image under a post token keys by the post
- "Ballers.2014.S01E01.HDTV.x264-KILLERS[ettv] 15_07_2015.rar", "Computer Bild - Ausgabe 152015 - 15_07_2015.rar": the cut after "] " or " - " left "15_07_2015.rar" for every item of a Razor1911 dump (1,335 files for 12); a date alone after the cut means the whole text is the name. - "MDG005b - (01/90) "IMG_2307.JPG"": a counter in parentheses makes no post key, so every "IMG" set of the poster was one (609 for 90); an image under a post token is keyed by it too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
590436d02a
commit
229189f35c
6 files changed
+39
-4
No files matched your search
+12
-1
@@ -320,6 +320,14 @@ fn is_image_name(name: &str) -> bool {
|
||||
[".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp", ".tif", ".tiff"].iter().any(|e| lower.ends_with(e))
|
||||
}
|
||||
|
||||
/// DATE_ONLY (lib/headers/subject.ts): a file name that is a date alone ("15_07_2015.rar").
|
||||
fn date_only(name: &str) -> bool {
|
||||
static DATE_ONLY: std::sync::LazyLock<regex::Regex> = std::sync::LazyLock::new(|| {
|
||||
regex::Regex::new(r"^(?:[0-9]{1,2}[-_.][0-9]{1,2}[-_.](?:19|20)[0-9]{2}|(?:19|20)[0-9]{2}[-_.][0-9]{1,2}[-_.][0-9]{1,2})\.[A-Za-z0-9]{2,4}$").unwrap()
|
||||
});
|
||||
DATE_ONLY.is_match(name)
|
||||
}
|
||||
|
||||
pub fn unquoted_name(before_counter: &str) -> Option<String> {
|
||||
let mut text = before_counter.trim_end_matches(js::is_space);
|
||||
if text.len() >= 4 && text.is_char_boundary(text.len() - 4) && text[text.len() - 4..].eq_ignore_ascii_case("yenc") {
|
||||
@@ -374,7 +382,8 @@ pub fn unquoted_name(before_counter: &str) -> Option<String> {
|
||||
// Or after an arrow ("… -> Exclusive-tgirls_000000-lg.jpg").
|
||||
let arrow = text.rfind("-> ").map_or(0, |i| i + 3);
|
||||
let cut = bracket.max(dash).max(arrow);
|
||||
let name = js::trim(&text[cut..]);
|
||||
// A date alone after the cut ("… [ettv] 15_07_2015.rar"): the whole text is the name.
|
||||
let name = if date_only(js::trim(&text[cut..])) { js::trim(text) } else { js::trim(&text[cut..]) };
|
||||
// An image after numbered text without a separator: its last word ("<abm> … AB: part2 0573-1002 043.jpg").
|
||||
// Not an index alone ("Teen Tease Self Shooter sad1 (10).jpg").
|
||||
if cut == 0 && is_image_name(name) && name.contains(' ') {
|
||||
@@ -978,6 +987,8 @@ mod unquoted_tests {
|
||||
("pal! [Mivina high(1).wmv\" yEnc] ", Some("Mivina high(1).wmv")),
|
||||
("[03/21 Geroellheimer - S03E16.part01.rar\" yEnc ", Some("Geroellheimer - S03E16.part01.rar")),
|
||||
("<Group> FP -> {EXL01~P~004} -> Alexia (3) -> VF -> [0001 of 0076] -> Exclusive-tgirls_000000-lg.jpg ", Some("Exclusive-tgirls_000000-lg.jpg")),
|
||||
("Ballers.2014.S01E01.HDTV.x264-KILLERS[ettv] 15_07_2015.rar ", Some("Ballers.2014.S01E01.HDTV.x264-KILLERS[ettv] 15_07_2015.rar")),
|
||||
("Computer Bild - Ausgabe 152015 - 15_07_2015.rar ", Some("Computer Bild - Ausgabe 152015 - 15_07_2015.rar")),
|
||||
("<abm> <Duke> here's a little thanksgiving present: AB: part2 0573-1002 043.jpg ", Some("043.jpg")),
|
||||
("xlady post You, Me And Dupree www.x2l.nl [001/106] 'You, Me And Dupree.nfo'", Some("You, Me And Dupree.nfo")),
|
||||
("[01/77][LIBRATEAM_M2219009.par2] Onbeperkt downloaden met een snelheid van 1,22 MB p.s. en dat voor maar 7,95 p.m. www.libranews.nl", Some("LIBRATEAM_M2219009.par2")),
|
||||
|
||||
+6
-1
@@ -843,7 +843,9 @@ pub fn release_identity(poster: &str, subject: &str, name: &str) -> Release {
|
||||
// Keyed by its set when its name has one ("diana-040-001.jpg").
|
||||
let name = if prefix.is_empty() { stem.clone() } else { prefix.clone() };
|
||||
let set = image_set(&stem);
|
||||
let key = if set.is_empty() { hash(&["stem", poster, &name]) } else { hash(&["stem", poster, &set]) };
|
||||
let set = if set.is_empty() { name.clone() } else { set };
|
||||
// Under a post token ("MDG005b - (01/90) "IMG_2307.JPG""): the post's too.
|
||||
let key = if is_post_token(&remainder) { hash(&["stem", poster, &set, &remainder]) } else { hash(&["stem", poster, &set]) };
|
||||
return Release { key, name, source: "stem", file_total };
|
||||
}
|
||||
// An audiobook's or album's tracks without a name around them: by their name without its numbers.
|
||||
@@ -1537,6 +1539,9 @@ mod image_set_tests {
|
||||
lois("02", "lois 1258 Billy Joel - Extremes.part01.rar lois 1258 Billy Joel - Extremes ").key,
|
||||
lois("01", "lois 1258 Billy Joel - Extremes.par2 lois 1258 Billy Joel - Extremes ").key
|
||||
);
|
||||
let mdg = |post: &str, i: &str, n: &str| super::release_identity("p", &format!(r#"{post} - ({i}/90) "{n}" - 16,14 MB - yEnc"#), n);
|
||||
assert_eq!(mdg("MDG005b", "01", "IMG_2307.JPG").key, mdg("MDG005b", "02", "IMG_2308.jpg").key);
|
||||
assert_ne!(mdg("MDG005b", "01", "IMG_2307.JPG").key, mdg("MDG006a", "01", "IMG_4410.JPG").key);
|
||||
let milf = |i: &str, n: &str, kb: &str| super::release_identity("p", &format!("(Hot MILF getting banged hard)[{i}/70] - {n} - {kb}"), n);
|
||||
assert_eq!(milf("27", "2407.jpg", "28").key, milf("28", "2408.jpg", "31").key);
|
||||
assert_eq!(super::file_stem_re("rld-gtre.r13.002"), "rld-gtre");
|
||||
|
||||
Reference in new issue
Block a user