tsk-62: Use QueuedSong and QueuedCoverArt to replace references to path of Song and CoverArt #64
39
src/main.rs
39
src/main.rs
@@ -65,8 +65,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
coverart,
|
||||
_metadata,
|
||||
queued_song,
|
||||
queued_coverart, // (song_queue_id, _song_queue_path),
|
||||
// (coverart_queue_id, _coverart_queue_path),
|
||||
queued_coverart,
|
||||
)) => {
|
||||
match wipe_data_from_queues(&app, &queued_song, &queued_coverart).await
|
||||
{
|
||||
@@ -189,35 +188,12 @@ async fn some_work(
|
||||
> {
|
||||
match prep_song(app, song_queue_id).await {
|
||||
Ok((
|
||||
// (song_directory, song_filename),
|
||||
queued_song,
|
||||
queued_coverart,
|
||||
// (coverart_directory, coverart_filename),
|
||||
metadata,
|
||||
// coverart_queue_id,
|
||||
)) => {
|
||||
println!("Prepping song");
|
||||
|
||||
/*
|
||||
let mut song_queue_path: String = String::new();
|
||||
let p = std::path::Path::new(&song_directory);
|
||||
let sp = p.join(&song_filename);
|
||||
song_queue_path.push_str(sp.to_str().unwrap_or_default());
|
||||
let coverart_queue = icarus_models::coverart::CoverArt {
|
||||
directory: coverart_directory,
|
||||
filename: coverart_filename,
|
||||
..Default::default()
|
||||
};
|
||||
let coverart_queue_path = match coverart_queue.get_path() {
|
||||
Ok(path) => path,
|
||||
Err(err) => {
|
||||
eprintln!("Could not get CoverArt path");
|
||||
eprintln!("Error: {err:?}");
|
||||
std::process::exit(-1);
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
match metadata::apply_metadata(&queued_song, &queued_coverart, &metadata).await {
|
||||
Ok(_applied) => {
|
||||
match api::update_queued_song::update_queued_song(app, &queued_song).await {
|
||||
@@ -293,12 +269,9 @@ async fn prep_song(
|
||||
song_queue_id: &uuid::Uuid,
|
||||
) -> Result<
|
||||
(
|
||||
// (String, String),
|
||||
queued_item::QueuedSong,
|
||||
queued_item::QueuedCoverArt,
|
||||
// (String, String),
|
||||
api::get_metadata_queue::response::Metadata,
|
||||
// uuid::Uuid,
|
||||
),
|
||||
reqwest::Error,
|
||||
> {
|
||||
@@ -317,12 +290,6 @@ async fn prep_song(
|
||||
..Default::default()
|
||||
};
|
||||
let songpath = song.song_path().unwrap_or_default();
|
||||
/*
|
||||
let song_queue_path = match song.save_to_filesystem() {
|
||||
Ok(_) => std::path::Path::new(&songpath),
|
||||
Err(_err) => std::path::Path::new(""),
|
||||
};
|
||||
*/
|
||||
|
||||
let queued_song: crate::queued_item::QueuedSong =
|
||||
match song.save_to_filesystem() {
|
||||
@@ -387,10 +354,10 @@ async fn prep_song(
|
||||
|
||||
let queued_coverart = queued_item::QueuedCoverArt {
|
||||
id: coverart_queue_id,
|
||||
coverart: coverart,
|
||||
coverart
|
||||
path: coverart_queue_fs_path
|
||||
};
|
||||
// let coverart_queue_path = std::path::Path::new(&coverart_queue_fs_path);
|
||||
|
||||
println!("Saved coverart queue file at: {:?}", queued_coverart.path);
|
||||
|
||||
Ok((queued_song, queued_coverart, metadata.clone()))
|
||||
|
Reference in New Issue
Block a user