Added code to wipe song queue data
This commit is contained in:
25
src/main.rs
25
src/main.rs
@@ -31,6 +31,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
(coverart_queue_id, coverart_queue_path),
|
||||
)) => {
|
||||
// TODO: Wipe data from song and coverart queues
|
||||
match wipe_data_from_queues(&app_base_url, &song_queue_id, &coverart_queue_id).await {
|
||||
Ok(_) => {
|
||||
}
|
||||
Err(err) => {
|
||||
eprintln!("Error: {err:?}");
|
||||
}
|
||||
}
|
||||
// TODO: Cleanup files in local filesystem
|
||||
}
|
||||
Err(err) => {
|
||||
@@ -51,6 +58,24 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
}
|
||||
|
||||
async fn wipe_data_from_queues(app_base_url: &String, song_queue_id: &uuid::Uuid, coverart_queue_id: &uuid::Uuid) -> Result<(), std::io::Error> {
|
||||
match the_rest::wipe_data::song_queue::wipe_data(app_base_url, song_queue_id).await {
|
||||
Ok(response) => match response.json::<the_rest::wipe_data::song_queue::response::Response>().await {
|
||||
Ok(_resp) => {
|
||||
println!("Wiped data from song queue");
|
||||
println!("Resp: {_resp:?}");
|
||||
Ok(())
|
||||
}
|
||||
Err(err) => {
|
||||
Err(std::io::Error::other(err.to_string()))
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
Err(std::io::Error::other(err.to_string()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn is_queue_empty(
|
||||
api_url: &String,
|
||||
) -> Result<(bool, responses::fetch_next_queue_item::SongQueueItem), reqwest::Error> {
|
||||
|
Reference in New Issue
Block a user