From 6e9e8df3bfd03b0aefd880f2099f15daa626fbff Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Sun, 6 Nov 2022 22:51:47 +0000 Subject: [PATCH] handle videos --- src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.rs b/src/main.rs index 12a3def..803e01d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -99,6 +99,12 @@ fn handle_mp3(file: DirEntry) { } } +fn handle_video(file: DirEntry) { + // todo if filename contains something like "(1971)" or "[2003]" it's a movie + // todo if filename contains something like "S03E21" it's a TV programme + move_file(file.path(), create_dir_if_not_exists(vec!["Videos"])); +} + fn handle_dir(path: PathBuf) { let dir = std::fs::read_dir(path).expect("Couldn't read dir"); @@ -117,6 +123,7 @@ fn handle_dir(path: PathBuf) { "jpeg" => { handle_image(inode) } "png" => { handle_image(inode) } "mp3" => { handle_mp3( inode) } + "mp4" => { handle_video( inode) } // todo m4a, flac, etc? _ => { /*println!("Here's where we would do nothing.");*/ } }