A random poster per file is no part of a release key
Releases 78361820 and 78411563 were two files of one FTD upload
("Yusef_Lateef-Alight_Upon_the_Lake_…-WEB-2026-FTD", [1/6] and [3/6], 4 s
apart) under a new random poster each ("N9vplIaavBCz@aCTVoAsk.JSE",
"FVWWHku0fGAg@QfaTz0g0.RVH"): the stem key includes the poster. When the
poster's own name (before the @) looks random, it's left out of the key;
real posters keep theirs (two uploaders of one scene release at the same
time stay apart), and uploads hours apart stay apart by the re-upload
rule. Both implementations; tests; fixtures identical.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b1213fbea0
commit
df35f4678c
3 files changed
+55
-5
No files matched your search
@@ -511,7 +511,17 @@ pub fn is_poster_tag(remainder: &str, stem: &str) -> bool {
|
||||
}
|
||||
|
||||
/// releaseIdentity for a named (not weak) file: never null.
|
||||
/// randomPoster (lib/release/identity.ts): a poster whose own name, before the "@", is a random token.
|
||||
pub fn random_poster(from: &str) -> bool {
|
||||
let address = match from.find('<').and_then(|open| from[open + 1..].find('>').map(|close| &from[open + 1..open + 1 + close])) {
|
||||
Some(address) => address,
|
||||
None => js::trim(from).split(' ').next().unwrap_or(""),
|
||||
};
|
||||
looks_random(address.split_once('@').map_or(address, |(local, _)| local))
|
||||
}
|
||||
|
||||
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 file_total = counter_total(subject).and_then(|t| t.parse::<i64>().ok());
|
||||
@@ -1033,6 +1043,19 @@ mod numbered_tests {
|
||||
mod image_set_tests {
|
||||
use super::{release_identity, subject_remainder, subject_remainder_re};
|
||||
|
||||
#[test]
|
||||
fn random_posters_are_no_part_of_the_key() {
|
||||
use super::random_poster;
|
||||
let ftd = "-Alight_Upon_the_Lake_(Live_at_the_Jazz_Showcase_Jun_1975)-WEB-2026-FTD";
|
||||
let a = release_identity("N9vplIaavBCz@aCTVoAsk.JSE", &format!("[1/6] - \"Yusef_Lateef{ftd}.par2\" yEnc 1744"), &format!("Yusef_Lateef{ftd}.par2"));
|
||||
let b = release_identity("FVWWHku0fGAg@QfaTz0g0.RVH", &format!("[3/6] - \"Yusef_Lateef{ftd}.part2.rar\" yEnc 104857600"), &format!("Yusef_Lateef{ftd}.part2.rar"));
|
||||
assert_eq!(a.key, b.key);
|
||||
assert!(random_poster("N9vplIaavBCz@aCTVoAsk.JSE"));
|
||||
assert!(!random_poster("Captain Salvo <Capt@Salvo.com>"));
|
||||
assert!(!random_poster("Poster49118 <Poster49118@generic.mail>"));
|
||||
assert!(!random_poster("w.merklein@freenet.de (muffin)"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sizes_in_brackets_and_one_word_sets() {
|
||||
for s in [r#"Aletta Ocean - "100628-035.jpg" yEnc [347K]"#, r#"Corie - "2877-041.jpg" yEnc [290K]"#, "x - !!!blob2010-102katie009.jpg 336573 byt"] {
|
||||
|
||||
Reference in new issue
Block a user