Functionality is working
Some checks failed
Rust Build / Check (pull_request) Failing after 31s
Rust Build / Test Suite (pull_request) Failing after 32s
Rust Build / Rustfmt (pull_request) Successful in 23s
Rust Build / Clippy (pull_request) Failing after 31s
Rust Build / build (pull_request) Failing after 35s

This commit is contained in:
2025-06-28 19:04:40 -04:00
parent 76024eeae9
commit 1aec73639f
2 changed files with 21 additions and 3 deletions

View File

@@ -85,7 +85,10 @@ async fn some_work(
.json::<update_queued_song::response::Response>()
.await
{
Ok(_inner_response) => Ok(()),
Ok(_inner_response) => {
println!("Response: {:?}", _inner_response);
Ok(())
}
Err(err) => Err(std::io::Error::other(err.to_string())),
}
}

View File

@@ -6,20 +6,35 @@ pub async fn update_queued_song(
) -> Result<reqwest::Response, reqwest::Error> {
let client = reqwest::Client::builder().build()?;
println!("Song path: {:?}", song_path);
let form = reqwest::multipart::Form::new().part(
"file",
reqwest::multipart::Part::bytes(std::fs::read(song_path).unwrap())
.file_name("track01.flac"),
);
let method = "PATCH";
// let method = "PATCH";
let url = format!("{}/api/v2/song/queue/{}", base_url, song_queue_id);
println!("Url: {:?}", url);
let content_type = "audio/flac";
// let mut headers = reqwest::header::HeaderMap::new();
// headers.insert(reqwest::header::CONTENT_TYPE, reqwest::header::HeaderValue::from_static(content_type));
let request = client
.request(reqwest::Method::from_bytes(method.as_bytes()).unwrap(), url)
// .request(reqwest::Method::from_bytes(method.as_bytes()).unwrap(), url)
.patch(url)
// .headers(headers)
.multipart(form);
println!("Request prepared");
println!("Request {:?}", request);
let response = request.send().await?;
println!("Sent");
Ok(response)
}