Refactoring #24

Merged
phoenix merged 3 commits from refactoring into devel 2025-06-14 01:30:50 +00:00
Showing only changes of commit cfe4254642 - Show all commits

View File

@@ -16,7 +16,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("SongQueueItem: {:?}", song_queue_item);
let song_queue_id = song_queue_item.data[0].id;
process_song(&app_base_url, &song_queue_id);
// TODO: Do something with the result later
let _ = process_song(&app_base_url, &song_queue_id).await;
} else {
println!("Queue is empty");
}
@@ -54,8 +55,8 @@ async fn is_queue_empty(
}
}
async fn process_song(api_url: &String, song_queue_id: &uuid::Uuid) {
match api::fetch_song_queue_data::get_data(&api_url, &song_queue_id).await {
async fn process_song(api_url: &String, song_queue_id: &uuid::Uuid) -> Result<(), reqwest::Error> {
match api::fetch_song_queue_data::get_data(api_url, song_queue_id).await {
Ok(response) => {
// Process data here...
match api::fetch_song_queue_data::response::parse_response(response).await {
@@ -65,7 +66,7 @@ async fn process_song(api_url: &String, song_queue_id: &uuid::Uuid) {
println!("Saved at: {:?}", save_path);
match api::get_metadata_queue::get(&api_url, &song_queue_id).await {
match api::get_metadata_queue::get(api_url, song_queue_id).await {
Ok(response) => {
match response
.json::<api::get_metadata_queue::response::Response>()
@@ -86,22 +87,28 @@ async fn process_song(api_url: &String, song_queue_id: &uuid::Uuid) {
// TODO: Create coverart
// TODO: Wipe data from queued song
// TODO: Wipe data from queued coverart
Ok(())
}
Err(err) => {
eprintln!("Error: {:?}", err);
Err(err)
}
}
}
Err(err) => {
eprintln!("Error: {:?}", err);
Err(err)
}
}
}
Err(err) => {}
Err(err) => {
Err(err)
}
}
}
Err(err) => {
eprintln!("Error fetching song queue data: {:?}", err);
Err(err)
}
}
}