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:
23
src/main.rs
23
src/main.rs
@@ -71,7 +71,7 @@ async fn some_work(
|
|||||||
song_queue_id: &uuid::Uuid,
|
song_queue_id: &uuid::Uuid,
|
||||||
) -> Result<(), std::io::Error> {
|
) -> Result<(), std::io::Error> {
|
||||||
match prep_song(app_base_url, song_queue_id).await {
|
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 {
|
match apply_metadata(&song_queue_path, &coverart_queue_path, &metadata).await {
|
||||||
Ok(_applied) => {
|
Ok(_applied) => {
|
||||||
match update_queued_song::update_queued_song(
|
match update_queued_song::update_queued_song(
|
||||||
@@ -94,9 +94,20 @@ async fn some_work(
|
|||||||
let user_id = uuid::Uuid::new_v4();
|
let user_id = uuid::Uuid::new_v4();
|
||||||
// TODO: Place this somewhere else
|
// TODO: Place this somewhere else
|
||||||
let song_type = String::from("flac");
|
let song_type = String::from("flac");
|
||||||
match the_rest::create_song(app_base_url, &metadata, &user_id, &song_type).await {
|
// Err(std::io::Error::other(err.to_string()))
|
||||||
Ok(_) => {
|
match the_rest::create_song::create(app_base_url, &metadata, &user_id, &song_type).await {
|
||||||
Ok(())
|
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(err) => {
|
||||||
Err(std::io::Error::other(err.to_string()))
|
Err(std::io::Error::other(err.to_string()))
|
||||||
@@ -119,7 +130,7 @@ async fn some_work(
|
|||||||
async fn prep_song(
|
async fn prep_song(
|
||||||
api_url: &String,
|
api_url: &String,
|
||||||
song_queue_id: &uuid::Uuid,
|
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 {
|
match api::fetch_song_queue_data::get_data(api_url, song_queue_id).await {
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
// Process data here...
|
// Process data here...
|
||||||
@@ -163,7 +174,7 @@ async fn prep_song(
|
|||||||
|
|
||||||
let c_path = util::path_buf_to_string(&coverart_queue_path);
|
let c_path = util::path_buf_to_string(&coverart_queue_path);
|
||||||
let s_path = util::path_buf_to_string(&song_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) => {
|
||||||
Err(err)
|
Err(err)
|
||||||
|
Reference in New Issue
Block a user