Some cleanup
All checks were successful
Rust Build / Check (pull_request) Successful in 44s
Rust Build / Test Suite (pull_request) Successful in 57s
Rust Build / Rustfmt (pull_request) Successful in 26s
Rust Build / Clippy (pull_request) Successful in 46s
Rust Build / build (pull_request) Successful in 1m16s

This commit is contained in:
2025-06-11 20:02:34 -04:00
parent 5c71504686
commit 38950d2e87

View File

@@ -19,7 +19,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
if !song_queue_item.data.is_empty() {
println!("Song queue item: {:?}", song_queue_item);
match api::fetch_song_queue_data::get_data(&app_base_url, &song_queue_item.data[0].id).await {
match api::fetch_song_queue_data::get_data(
&app_base_url,
&song_queue_item.data[0].id,
)
.await
{
Ok(response) => {
// TODO: At some point, handle the flow if the size is small or
// large
@@ -33,11 +38,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut song = icarus_models::song::Song::default();
song.data = all_bytes;
song.filename = song.generate_filename(icarus_models::types::MusicTypes::FlacExtension, true);
song.filename = song.generate_filename(
icarus_models::types::MusicTypes::FlacExtension,
true,
);
// TODO: Add function to save bytes to a file in icarus_models
// repo
song.directory = icarus_envy::environment::get_root_directory().await;
song.directory =
icarus_envy::environment::get_root_directory().await;
let dir = std::path::Path::new(&song.directory);
let save_path = dir.join(&song.filename);
@@ -46,26 +56,22 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
file.write_all(&song.data).unwrap();
println!("File saved to: {:?}", save_path);
// Process data here...
// TODO: Parse the response body to a struct
// TODO: Get queued song data
// TODO: Get queued song's metadata
// TODO: Get queued coverart
// TODO: Get queued coverart's data
// TODO: Apply metadata to the queued song
// TODO: Update the queued song with the updated queued song
// TODO: Create song
// TODO: Create coverart
// TODO: Wipe data from queued song
// TODO: Wipe data from queued coverart
// Process data here...
// TODO: Get queued song's metadata
// TODO: Get queued coverart
// TODO: Get queued coverart's data
// TODO: Apply metadata to the queued song
// TODO: Update the queued song with the updated queued song
// TODO: Create song
// TODO: Create coverart
// TODO: Wipe data from queued song
// TODO: Wipe data from queued coverart
}
Err(err) => {
eprintln!("Error fetching song queue data: {:?}", err);
}
}
} else {
println!("No data to fetch");
}
@@ -113,7 +119,10 @@ mod api {
}
pub mod fetch_song_queue_data {
pub async fn get_data(base_url: &String, id: &uuid::Uuid) -> Result<reqwest::Response, reqwest::Error> {
pub async fn get_data(
base_url: &String,
id: &uuid::Uuid,
) -> Result<reqwest::Response, reqwest::Error> {
let client = reqwest::Client::new();
let endpoint = String::from("api/v2/song/queue");
let api_url = format!("{}/{}/{}", base_url, endpoint, id);