A random name's volumes with extensions of their own; a padded volume after a date
- "df2BkeRxIvHcWrsWwwz.part01.cer" … ".part69.bdmv", "jA0eSSUMat8tQtIKUyPMA.part01": obfuscators give each volume its own extension (or none); for a random name (no dots or spaces) .partNN and that extension go. - "(????) [0001/1009] - "CHT PCK 2 9.26.001"": a volume of 3-5 digits after a dot counts with a digit before it too (5,419 single files of YME). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c624a624df
commit
208ca1d535
3 files changed
+53
-4
No files matched your search
+24
-2
@@ -748,7 +748,7 @@ pub fn release_identity(poster: &str, subject: &str, name: &str) -> Release {
|
||||
let poster = if random_poster(poster) { "" } else { poster };
|
||||
// The post rule's key takes the [i/M] total; the release's file total any counter's (counterTotal).
|
||||
let post_total = file_counter_total(subject);
|
||||
let stem = file_stem(run_on(name));
|
||||
let stem = random_volume_base(file_stem(run_on(name)));
|
||||
// A name that isn't quoted (unquoted_name) is taken out as the quotes would have been.
|
||||
// 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: …").
|
||||
@@ -895,7 +895,9 @@ pub fn release_identity(poster: &str, subject: &str, name: &str) -> Release {
|
||||
}
|
||||
}
|
||||
// A numbered volume as the extension, within the counter's total ("DN.VPL PCK.1508" of 2195): one upload.
|
||||
let base = match (VOLUME_NUMBER.captures(stem.as_bytes()), post_total.filter(|&n| n != 0)) {
|
||||
// Also zero-padded after a date ("CHT PCK 2 9.26.001").
|
||||
let volume = VOLUME_NUMBER.captures(stem.as_bytes()).or_else(|| PADDED_VOLUME.captures(stem.as_bytes()));
|
||||
let base = match (volume, post_total.filter(|&n| n != 0)) {
|
||||
(Some(c), Some(total)) if number(&c[2]) <= total as f64 => String::from_utf8(c[1].to_vec()).unwrap(),
|
||||
_ => stem.clone(),
|
||||
};
|
||||
@@ -926,6 +928,20 @@ static SCENE_RELEASE: LazyLock<Regex> = LazyLock::new(|| {
|
||||
});
|
||||
/// RANDOM_VOLUME (lib/release/identity.ts): a file of a multi-volume upload.
|
||||
static RANDOM_VOLUME: LazyLock<Regex> = LazyLock::new(|| re(r"(?i)\.(?:part[0-9]+\.rar|vol[0-9]+[+-][0-9]+\.par2|par2|r[0-9]{2,3}|7z\.[0-9]{3}|zip\.[0-9]{3}|[0-9]{3})$"));
|
||||
/// PADDED_VOLUME (lib/release/identity.ts): a volume number of 3–5 digits after a dot.
|
||||
static PADDED_VOLUME: LazyLock<Regex> = LazyLock::new(|| re(r"^(.*[A-Za-z].*?)\.([0-9]{3,5})$"));
|
||||
/// RANDOM_PART (lib/release/identity.ts): a random name's volume with any short extension, or none.
|
||||
static RANDOM_PART: LazyLock<Regex> = LazyLock::new(|| re(r"^(.+)\.part[0-9]{2,}(?:\.[A-Za-z0-9]{1,5})?$"));
|
||||
|
||||
/// randomVolumeBase (lib/release/identity.ts): a random name's volume number and extension off its stem.
|
||||
pub fn random_volume_base(stem: String) -> String {
|
||||
let base = RANDOM_PART.captures(stem.as_bytes()).map(|c| String::from_utf8(c[1].to_vec()).unwrap());
|
||||
match base {
|
||||
Some(b) if b.bytes().all(|c| c.is_ascii_alphanumeric() || c == b'_' || c == b'-') && looks_random(&b.chars().filter(|c| !matches!(c, '-' | '_')).collect::<String>()) => b,
|
||||
_ => stem,
|
||||
}
|
||||
}
|
||||
|
||||
static VOLUME_NUMBER: LazyLock<Regex> = LazyLock::new(|| re(r"^(.*[^0-9. ])[. ]([0-9]{1,5})\.?$"));
|
||||
|
||||
static GENERIC: LazyLock<Regex> = LazyLock::new(|| {
|
||||
@@ -1582,6 +1598,12 @@ mod image_set_tests {
|
||||
assert_eq!(show("01", "The.Big.Bang.Theory.S01E01.part01.rar").key, show("20", "The.Big.Bang.Theory.S01E01.nfo").key);
|
||||
let tender = |i: &str, n: &str| super::release_identity("p", &format!("Tender TEEN SEX in HD - File {i} of 435 - {n}"), n);
|
||||
assert_eq!(tender("001", "a1 (2).jpg").key, tender("002", "a1.jpg").key);
|
||||
let rv = |i: &str, total: &str, n: &str| super::release_identity("p", &format!(r#"[{i}/{total}] - "{n}" yEnc"#), n);
|
||||
assert_eq!(rv("01", "69", "df2BkeRxIvHcWrsWwwz.part01.cer").key, rv("69", "69", "df2BkeRxIvHcWrsWwwz.part69.bdmv").key);
|
||||
assert_eq!(rv("01", "32", "jA0eSSUMat8tQtIKUyPMA.part01").key, rv("32", "32", "jA0eSSUMat8tQtIKUyPMA.part32").key);
|
||||
assert_ne!(rv("01", "2", "Some.Movie.Part01.mkv").key, rv("02", "2", "Some.Movie.Part02.mkv").key);
|
||||
let pck = |i: &str, n: &str| super::release_identity("YME", &format!(r#"(????) [{i}/1009] - "{n}" yEnc"#), n);
|
||||
assert_eq!(pck("0001", "CHT PCK 2 9.26.001").key, pck("0002", "CHT PCK 2 9.26.002").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