Spaces at a dash are no part of a stem key
"www.realmom.info - XVID- Farbiges Krabbeltier.r00" beside "… XVID-Farbiges Krabbeltier.vol03+04.par2": 52 JBinUp uploads were two releases each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
550f63cd84
commit
96553a5504
3 files changed
+14
-2
No files matched your search
+6
-1
@@ -884,9 +884,12 @@ pub fn release_identity(poster: &str, subject: &str, name: &str) -> Release {
|
||||
let b = lower.as_bytes();
|
||||
let index = if b.starts_with(b"00") { 2 + b[2..].iter().take_while(|c| matches!(c, b'-' | b'_' | b' ' | b'.')).count() } else { 0 };
|
||||
let key_stem = if index > 2 { &lower[index..] } else { &lower[..] };
|
||||
Release { key: hash(&["stem", poster, key_stem]), name: stem, source: "stem", file_total }
|
||||
// Nor spaces at a dash ("… XVID- Farbiges Krabbeltier.r00" beside "… XVID-Farbiges Krabbeltier.vol03+04.par2").
|
||||
let key_stem = replace(&DASH_SPACES, key_stem, "-", true);
|
||||
Release { key: hash(&["stem", poster, &key_stem]), name: stem, source: "stem", file_total }
|
||||
}
|
||||
|
||||
static DASH_SPACES: LazyLock<Regex> = LazyLock::new(|| re(r" *- *"));
|
||||
static HEX_ID: LazyLock<Regex> = LazyLock::new(|| re(r"(?i)\[[0-9a-f]{8,}\]"));
|
||||
static VIDEO: LazyLock<Regex> = LazyLock::new(|| re(r"(?i)\.(mkv|mp4|avi|m4v|ts|wmv|mov)$"));
|
||||
static EPISODE: LazyLock<Regex> = LazyLock::new(|| re(r"(?i)^(.+?)[ ._-]+S([0-9]{1,2})E[0-9]{1,3}"));
|
||||
@@ -1541,6 +1544,8 @@ 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 jb = |i: &str, n: &str| super::release_identity("JBinUp", &format!(r#"[{i}/58] - Summer Power Up - "{n}" yEnc"#), n);
|
||||
assert_eq!(jb("01", "www.realmom.info - XVID- Farbiges Krabbeltier.r00").key, jb("54", "www.realmom.info - XVID-Farbiges Krabbeltier.vol03+04.par2").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);
|
||||
|
||||
Reference in new issue
Block a user