Added functionality to create song and made changes to prep_song()
Some checks failed
Rust Build / Check (pull_request) Failing after 31s
Rust Build / Test Suite (pull_request) Failing after 34s
Rust Build / Rustfmt (pull_request) Failing after 26s
Rust Build / Clippy (pull_request) Failing after 33s
Rust Build / build (pull_request) Failing after 34s
Some checks failed
Rust Build / Check (pull_request) Failing after 31s
Rust Build / Test Suite (pull_request) Failing after 34s
Rust Build / Rustfmt (pull_request) Failing after 26s
Rust Build / Clippy (pull_request) Failing after 33s
Rust Build / build (pull_request) Failing after 34s
This commit is contained in:
21
src/main.rs
21
src/main.rs
@@ -71,7 +71,7 @@ async fn some_work(
|
||||
song_queue_id: &uuid::Uuid,
|
||||
) -> Result<(), std::io::Error> {
|
||||
match prep_song(app_base_url, song_queue_id).await {
|
||||
Ok((song_queue_path, coverart_queue_path, metadata)) => {
|
||||
Ok((song_queue_path, coverart_queue_path, metadata, coverart_queue_id)) => {
|
||||
match apply_metadata(&song_queue_path, &coverart_queue_path, &metadata).await {
|
||||
Ok(_applied) => {
|
||||
match update_queued_song::update_queued_song(
|
||||
@@ -94,14 +94,25 @@ async fn some_work(
|
||||
let user_id = uuid::Uuid::new_v4();
|
||||
// TODO: Place this somewhere else
|
||||
let song_type = String::from("flac");
|
||||
match the_rest::create_song(app_base_url, &metadata, &user_id, &song_type).await {
|
||||
Ok(_) => {
|
||||
// Err(std::io::Error::other(err.to_string()))
|
||||
match the_rest::create_song::create(app_base_url, &metadata, &user_id, &song_type).await {
|
||||
Ok(response) => match response.json::<the_rest::create_song::response::Response>().await {
|
||||
Ok(resp) => {
|
||||
println!("Response: {resp:?}");
|
||||
|
||||
let song = &resp.data[0];
|
||||
println!("Song id: {:?}", song.id);
|
||||
// println!("Response json: {:?}", response.text().await);
|
||||
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())),
|
||||
}
|
||||
@@ -119,7 +130,7 @@ async fn some_work(
|
||||
async fn prep_song(
|
||||
api_url: &String,
|
||||
song_queue_id: &uuid::Uuid,
|
||||
) -> Result<(String, String, api::get_metadata_queue::response::Metadata), reqwest::Error> {
|
||||
) -> Result<(String, String, api::get_metadata_queue::response::Metadata, uuid::Uuid), reqwest::Error> {
|
||||
match api::fetch_song_queue_data::get_data(api_url, song_queue_id).await {
|
||||
Ok(response) => {
|
||||
// Process data here...
|
||||
@@ -163,7 +174,7 @@ async fn prep_song(
|
||||
|
||||
let c_path = util::path_buf_to_string(&coverart_queue_path);
|
||||
let s_path = util::path_buf_to_string(&song_queue_path);
|
||||
Ok((s_path, c_path, metadata.clone()))
|
||||
Ok((s_path, c_path, metadata.clone(), *coverart_queue_id))
|
||||
}
|
||||
Err(err) => {
|
||||
Err(err)
|
||||
|
Reference in New Issue
Block a user