update queued song #28

Merged
phoenix merged 20 commits from update_queued_song into devel 2025-06-28 23:23:42 +00:00
2 changed files with 21 additions and 3 deletions
Showing only changes of commit 1aec73639f - Show all commits

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)
}