handle videos

This commit is contained in:
Max Bradbury 2022-11-06 22:51:47 +00:00
parent 3eb674651b
commit 6e9e8df3bf
1 changed files with 7 additions and 0 deletions

View File

@ -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.");*/ }
}