tsk-50: Create functionality to extract song properties #52

Merged
phoenix merged 8 commits from tsk-50 into main 2025-11-06 17:31:37 +00:00
Showing only changes of commit fe7b591a2f - Show all commits

View File

@@ -43,8 +43,13 @@ mod tests {
match test_util::util::file_exists(&dir, &filename) { match test_util::util::file_exists(&dir, &filename) {
Ok(_) => { Ok(_) => {
let filepath = test_util::util::get_full_path(&dir, &filename).unwrap(); let filepath = test_util::util::get_full_path(&dir, &filename).unwrap();
match super::get_duration(&filepath) { let new_filepath = test_util::util::generate_newfilepath(&dir).unwrap();
match test_util::util::copy_file(&filepath, &new_filepath) {
Ok(_) => match super::get_duration(&new_filepath) {
Ok(duration) => { Ok(duration) => {
test_util::util::remove_file(&new_filepath).unwrap();
let song_duration: u64 = 41; let song_duration: u64 = 41;
let fetched_song_duration = duration.as_secs(); let fetched_song_duration = duration.as_secs();
@@ -56,6 +61,10 @@ mod tests {
Err(err) => { Err(err) => {
assert!(false, "Error: {err:?}"); assert!(false, "Error: {err:?}");
} }
},
Err(err) => {
assert!(false, "Error: {err:?}");
}
} }
} }
Err(err) => { Err(err) => {
@@ -75,8 +84,10 @@ mod tests {
let new_filepath = test_util::util::generate_newfilepath(&dir).unwrap(); let new_filepath = test_util::util::generate_newfilepath(&dir).unwrap();
match test_util::util::copy_file(&filepath, &new_filepath) { match test_util::util::copy_file(&filepath, &new_filepath) {
Ok(_) => match super::get_song_properties(&filepath) { Ok(_) => match super::get_song_properties(&new_filepath) {
Ok(song_properties) => { Ok(song_properties) => {
test_util::util::remove_file(&new_filepath).unwrap();
let song_duration: u64 = 41; let song_duration: u64 = 41;
let bitrate: u32 = 1; let bitrate: u32 = 1;
let overall_bitrate: u32 = 3; let overall_bitrate: u32 = 3;