Wipe data from CoverArt queue (#36)
Some checks failed
Release Tagging / release (push) Successful in 32s
Rust Build / Check (push) Failing after 34s
Rust Build / Test Suite (push) Failing after 37s
Rust Build / Rustfmt (push) Successful in 29s
Rust Build / Clippy (push) Failing after 36s
Rust Build / build (push) Failing after 37s
Rust Build / Check (pull_request) Failing after 1m58s
Rust Build / Test Suite (pull_request) Failing after 1m21s
Rust Build / Rustfmt (pull_request) Successful in 29s
Rust Build / Clippy (pull_request) Failing after 1m7s
Rust Build / build (pull_request) Failing after 2m5s

Reviewed-on: #36
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
2025-07-15 20:10:12 +00:00
committed by phoenix
parent 47bf24180b
commit 111d16515f
4 changed files with 49 additions and 10 deletions

2
Cargo.lock generated
View File

@@ -1255,7 +1255,7 @@ dependencies = [
[[package]] [[package]]
name = "songparser" name = "songparser"
version = "0.2.2" version = "0.2.3"
dependencies = [ dependencies = [
"futures", "futures",
"icarus_envy", "icarus_envy",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "songparser" name = "songparser"
version = "0.2.2" version = "0.2.3"
edition = "2024" edition = "2024"
rust-version = "1.88" rust-version = "1.88"

View File

@@ -25,8 +25,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
// TODO: Do something with the result later // TODO: Do something with the result later
match some_work(&app_base_url, &song_queue_id).await { match some_work(&app_base_url, &song_queue_id).await {
Ok(( Ok((
song, _song,
coverart, _coverart,
(song_queue_id, song_queue_path), (song_queue_id, song_queue_path),
(coverart_queue_id, coverart_queue_path), (coverart_queue_id, coverart_queue_path),
)) => { )) => {
@@ -38,12 +38,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
) )
.await .await
{ {
Ok(_) => {} Ok(_) => {
// TODO: Cleanup files in local filesystem
}
Err(err) => { Err(err) => {
eprintln!("Error: {err:?}"); eprintln!("Error: {err:?}");
} }
} }
// TODO: Cleanup files in local filesystem
} }
Err(err) => { Err(err) => {
eprintln!("Error: {err:?}"); eprintln!("Error: {err:?}");
@@ -73,10 +74,25 @@ async fn wipe_data_from_queues(
.json::<the_rest::wipe_data::song_queue::response::Response>() .json::<the_rest::wipe_data::song_queue::response::Response>()
.await .await
{ {
Ok(_resp) => { Ok(_resp) => match the_rest::wipe_data::coverart_queue::wipe_data(
println!("Wiped data from song queue"); app_base_url,
Ok(()) coverart_queue_id,
} )
.await
{
Ok(inner_response) => match inner_response
.json::<the_rest::wipe_data::coverart_queue::response::Response>()
.await
{
Ok(_inner_resp) => {
println!("Wiped data from CoverArt queue");
println!("Resp: {_inner_resp:?}");
Ok(())
}
Err(err) => Err(std::io::Error::other(err.to_string())),
},
Err(err) => Err(std::io::Error::other(err.to_string())),
},
Err(err) => Err(std::io::Error::other(err.to_string())), Err(err) => Err(std::io::Error::other(err.to_string())),
}, },
Err(err) => Err(std::io::Error::other(err.to_string())), Err(err) => Err(std::io::Error::other(err.to_string())),

View File

@@ -99,4 +99,27 @@ pub mod wipe_data {
} }
} }
// TODO: Wipe data from queued coverart // TODO: Wipe data from queued coverart
pub mod coverart_queue {
pub async fn wipe_data(
base_url: &String,
coverart_queue_id: &uuid::Uuid,
) -> Result<reqwest::Response, reqwest::Error> {
let client = reqwest::Client::builder().build()?;
let url = format!("{base_url}/api/v2/coverart/queue/data/wipe");
let payload = serde_json::json!({
"coverart_queue_id": coverart_queue_id
});
let request = client.patch(url).json(&payload);
request.send().await
}
pub mod response {
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct Response {
pub message: String,
pub data: Vec<uuid::Uuid>,
}
}
}
} }