Added function to apply metadata to song queue file
This commit is contained in:
22
src/main.rs
22
src/main.rs
@@ -62,9 +62,9 @@ async fn process_song(api_url: &String, song_queue_id: &uuid::Uuid) -> Result<()
|
|||||||
match api::parsing::parse_response_into_bytes(response).await {
|
match api::parsing::parse_response_into_bytes(response).await {
|
||||||
Ok(song_bytes) => {
|
Ok(song_bytes) => {
|
||||||
let (directory, filename) = generate_song_queue_dir_and_filename().await;
|
let (directory, filename) = generate_song_queue_dir_and_filename().await;
|
||||||
let save_path = save_file_to_fs(&directory, &filename, &song_bytes).await;
|
let song_queue_path = save_file_to_fs(&directory, &filename, &song_bytes).await;
|
||||||
|
|
||||||
println!("Saved at: {:?}", save_path);
|
println!("Saved at: {:?}", song_queue_path);
|
||||||
|
|
||||||
match api::get_metadata_queue::get(api_url, song_queue_id).await {
|
match api::get_metadata_queue::get(api_url, song_queue_id).await {
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
@@ -93,9 +93,17 @@ async fn process_song(api_url: &String, song_queue_id: &uuid::Uuid) -> Result<()
|
|||||||
Ok(response) => match api::parsing::parse_response_into_bytes(response).await {
|
Ok(response) => match api::parsing::parse_response_into_bytes(response).await {
|
||||||
Ok(coverart_queue_bytes) => {
|
Ok(coverart_queue_bytes) => {
|
||||||
let (directory, filename) = generate_coverart_queue_dir_and_filename().await;
|
let (directory, filename) = generate_coverart_queue_dir_and_filename().await;
|
||||||
let save_path = save_file_to_fs(&directory, &filename, &coverart_queue_bytes).await;
|
let coverart_queue_path = save_file_to_fs(&directory, &filename, &coverart_queue_bytes).await;
|
||||||
|
|
||||||
println!("Saved coverart queue file at: {:?}", save_path);
|
println!("Saved coverart queue file at: {:?}", coverart_queue_path);
|
||||||
|
|
||||||
|
match apply_metadata(&song_queue_path, &coverart_queue_path).await {
|
||||||
|
Ok(_) => {
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("Error: {:?}", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Apply metadata to the queued song (modifying file)
|
// TODO: Apply metadata to the queued song (modifying file)
|
||||||
// TODO: Update the queued song with the updated queued song
|
// TODO: Update the queued song with the updated queued song
|
||||||
@@ -199,6 +207,12 @@ pub async fn save_file_to_fs(
|
|||||||
save_path
|
save_path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Implement
|
||||||
|
pub async fn apply_metadata(song_queue_path: &std::path::PathBuf, coverart_queue_path: &std::path::PathBuf) -> Result<bool, u32> {
|
||||||
|
|
||||||
|
Ok(false)
|
||||||
|
}
|
||||||
|
|
||||||
mod responses {
|
mod responses {
|
||||||
pub mod fetch_next_queue_item {
|
pub mod fetch_next_queue_item {
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|||||||
Reference in New Issue
Block a user