Albums: no numbered volumes or stray suffixes; the replay report counts the group's releases
acs5152s1.11 is a volume, Broforce.vol00+01.par2.temp a par2: neither an album's member. replay:corpus reported every release in the scratch catalog as the group's. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
4d0610ca06
commit
6860e6ccaf
2 files changed
+15
-8
No files matched your search
+7
-2
@@ -737,10 +737,12 @@ struct OpenAlbum {
|
||||
/// The template a file name joins an album by: every digit run as "#" ("1481439079025_014.jpg.data" →
|
||||
/// "#_#.jpg.data"); none for a name without a number, a random one, an archive, a volume or a sidecar.
|
||||
pub fn album_template(name: &str) -> Option<String> {
|
||||
if is_random_file(name) || names::is_par2(name) || names::is_archive_start(name) || names::is_later_volume(name) || names::is_sidecar(name) {
|
||||
let (stem, ext) = split_extension(name);
|
||||
// A numbered extension is a volume ("acs5152s1.11"), and a stray suffix hides none of the above ("x.par2.temp").
|
||||
let volume = |n: &str| names::is_par2(n) || names::is_archive_start(n) || names::is_later_volume(n);
|
||||
if is_random_file(name) || names::is_sidecar(name) || volume(name) || volume(stem) || (ext.len() > 1 && ext.bytes().skip(1).all(|c| c.is_ascii_digit())) {
|
||||
return None;
|
||||
}
|
||||
let (stem, ext) = split_extension(name);
|
||||
let mut out = String::with_capacity(name.len());
|
||||
let mut runs = 0;
|
||||
let mut in_digits = false;
|
||||
@@ -1416,6 +1418,9 @@ mod tests {
|
||||
assert_eq!(album_template("Scan_001.vol00+01.par2"), None);
|
||||
assert_eq!(album_template("Scan_001.nfo"), None);
|
||||
assert_eq!(album_template("NoNumber.mp4"), None);
|
||||
assert_eq!(album_template("acs5152s1.11"), None);
|
||||
assert_eq!(album_template("Broforce.vol00+01.par2.temp"), None);
|
||||
assert_eq!(album_template("Starship For Rent 3 (2024).epub").as_deref(), Some("Starship For Rent # (#).epub"));
|
||||
assert_eq!(album_template("c3453cdd2a3645a8f3cf3d22319abe63"), None);
|
||||
assert_eq!(album_name(&["1481439079025_001.jpg.data", "1481439079025_014.jpg.data"]), "1481439079025_#.jpg.data");
|
||||
assert_eq!(album_name(&["1481439079025_001.jpg.data", "1481439080000_001.jpg.data"]), "#_001.jpg.data");
|
||||
|
||||
Reference in new issue
Block a user