update queued song #28

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

View File

@@ -1,3 +1,6 @@
pub mod the_rest;
pub mod util;
use std::io::Write;
pub const SECONDS_TO_SLEEP: u64 = 5;
@@ -97,8 +100,10 @@ async fn process_song(api_url: &String, song_queue_id: &uuid::Uuid) -> Result<()
println!("Saved coverart queue file at: {:?}", coverart_queue_path);
match apply_metadata(song_queue_path, coverart_queue_path, metadata).await {
match apply_metadata(song_queue_path.clone(), coverart_queue_path, metadata).await {
Ok(_) => {
let s_path = util::path_buf_to_string(&song_queue_path);
the_rest::update_queued_song(&s_path).await;
// TODO: Update the queued song with the updated queued song
// TODO: Create song
// TODO: Create coverart
@@ -211,10 +216,7 @@ pub async fn apply_metadata(
metadata: &api::get_metadata_queue::response::Metadata,
) -> Result<bool, std::io::Error> {
// Apply metadata fields
let s_path = match song_queue_path.to_str() {
Some(val) => String::from(val),
None => String::new(),
};
let s_path = util::path_buf_to_string(&song_queue_path);
if s_path.is_empty() {
println!("Song queue path is empty");
@@ -326,10 +328,7 @@ pub async fn apply_metadata(
}
// Apply coverart
let c_path: String = match coverart_queue_path.to_str() {
Some(val) => String::from(val),
None => String::new(),
};
let c_path: String = util::path_buf_to_string(&coverart_queue_path);
match icarus_meta::meta::coverart::contains_coverart(&s_path) {
Ok((exists, size)) => {

4
src/the_rest.rs Normal file
View File

@@ -0,0 +1,4 @@
// TODO: Refactor this file when this app is functional
pub async fn update_queued_song(song_path: &String) {
}

10
src/util.rs Normal file
View File

@@ -0,0 +1,10 @@
pub fn path_buf_to_string(path: &std::path::PathBuf) -> String {
let s_path = match path.to_str() {
Some(val) => String::from(val),
None => String::new(),
};
s_path
}