add dir per title

This commit is contained in:
Paul Campbell 2023-11-12 14:39:47 +00:00
parent 64b0e0050a
commit e22c29ce64

View file

@ -33,8 +33,8 @@ fn rename_files(directory: &str, base: &str) -> Result<i32> {
let album = parse_album(&title); let album = parse_album(&title);
count += 1; count += 1;
let new_name = match album.len() { let new_name = match album.len() {
0 => format!("{artist}/{title}.m4b"), 0 => format!("{artist}/{title}/{title}.m4b"),
_ => format!("{artist}/{album}/{title}.m4b"), _ => format!("{artist}/{album}/{title}/{title}.m4b"),
}; };
println!("Renaming {} to {}", path.display(), new_name); println!("Renaming {} to {}", path.display(), new_name);
let target_path = Path::new(&base).join(new_name); let target_path = Path::new(&base).join(new_name);