diff --git a/src/main.rs b/src/main.rs index 9a331ad..cc8673e 100755 --- a/src/main.rs +++ b/src/main.rs @@ -28,8 +28,8 @@ fn main() -> Result<(), Box> { match &args.command { Commands::Import { file } => { - println!("Importing file: {:?}", file); if file.is_dir() { + println!("Importing folder: {:?}", file); for music_file in read_dir(file)? { let path = music_file?.path(); if path @@ -40,11 +40,12 @@ fn main() -> Result<(), Box> { continue; } let tag = get_metadata(&path); - let _ = move_files(path, tag.clone()); + let _ = move_files(path, tag.clone(), extra_files.clone()); } } else { + println!("Importing file: {:?}", file); let tag = get_metadata(file); - let _ = move_files(file.clone(), tag.clone()); + let _ = move_files(file.clone(), tag.clone(), extra_files); } } Commands::Show { file } => { @@ -73,8 +74,11 @@ fn get_metadata>(file_path: P) -> lofty::tag::Tag { tag.clone() } -fn move_files(file_path: PathBuf, tag: Tag) -> Result<(), Box> { - println!("{:?}", file_path); +fn move_files( + file_path: PathBuf, + tag: Tag, + extra_files: [String; 8], +) -> Result<(), Box> { let target_dir = PathBuf::from("/home/user/Desktop/coding/keks-sort"); let artist = tag.artist(); @@ -96,13 +100,33 @@ fn move_files(file_path: PathBuf, tag: Tag) -> Result<(), Box