diff --git a/src/main.rs b/src/main.rs index 88d42eb..4dc98ee 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,10 +28,16 @@ async fn main() -> Result<(), Box> { { Ok(response) => { // Process data here... - let all_bytes = api::fetch_song_queue_data::response::parse_response(response).await?; + let all_bytes = + api::fetch_song_queue_data::response::parse_response( + response, + ) + .await?; - let (directory, filename) = generate_song_queue_dir_and_filename().await; - let save_path = save_song_to_fs(&directory, &filename, &all_bytes).await; + let (directory, filename) = + generate_song_queue_dir_and_filename().await; + let save_path = + save_song_to_fs(&directory, &filename, &all_bytes).await; println!("Saved at: {:?}", save_path); @@ -69,10 +75,7 @@ async fn main() -> Result<(), Box> { // TODO: Consider having something like this in icarus_models pub async fn generate_song_queue_dir_and_filename() -> (String, String) { let mut song = icarus_models::song::Song::default(); - song.filename = song.generate_filename( - icarus_models::types::MusicTypes::FlacExtension, - true, - ); + song.filename = song.generate_filename(icarus_models::types::MusicTypes::FlacExtension, true); song.directory = icarus_envy::environment::get_root_directory().await; @@ -80,7 +83,11 @@ pub async fn generate_song_queue_dir_and_filename() -> (String, String) { } // TODO: Check to see if this is available in icarus_models -pub async fn save_song_to_fs(directory: &String, filename: &String, data: &Vec) -> std::path::PathBuf { +pub async fn save_song_to_fs( + directory: &String, + filename: &String, + data: &Vec, +) -> std::path::PathBuf { // TODO: Add function to save bytes to a file in icarus_models // repo let dir = std::path::Path::new(directory); @@ -92,7 +99,6 @@ pub async fn save_song_to_fs(directory: &String, filename: &String, data: &Vec Result, reqwest::Error> { - + pub async fn parse_response( + response: reqwest::Response, + ) -> Result, reqwest::Error> { // TODO: At some point, handle the flow if the size is small or // large let mut byte_stream = response.bytes_stream();