tsk-62: Replaced references
This commit is contained in:
37
src/main.rs
37
src/main.rs
@@ -63,10 +63,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Ok((
|
||||
song,
|
||||
coverart,
|
||||
(song_queue_id, _song_queue_path),
|
||||
(coverart_queue_id, _coverart_queue_path),
|
||||
_metadata,
|
||||
queued_song,
|
||||
queued_coverart
|
||||
// (song_queue_id, _song_queue_path),
|
||||
// (coverart_queue_id, _coverart_queue_path),
|
||||
)) => {
|
||||
match wipe_data_from_queues(&app, &song_queue_id, &coverart_queue_id)
|
||||
match wipe_data_from_queues(&app, &queued_song, &queued_coverart)
|
||||
.await
|
||||
{
|
||||
Ok(_) => match cleanup(&song, &coverart).await {
|
||||
@@ -102,16 +105,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
async fn wipe_data_from_queues(
|
||||
app: &config::App,
|
||||
song_queue_id: &uuid::Uuid,
|
||||
coverart_queue_id: &uuid::Uuid,
|
||||
queued_song: &crate::queued_item::QueuedSong,
|
||||
queued_coverart: &crate::queued_item::QueuedCoverArt
|
||||
) -> Result<(), std::io::Error> {
|
||||
match api::wipe_data::song_queue::wipe_data(app, song_queue_id).await {
|
||||
match api::wipe_data::song_queue::wipe_data(app, queued_song).await {
|
||||
Ok(response) => match response
|
||||
.json::<api::wipe_data::song_queue::response::Response>()
|
||||
.await
|
||||
{
|
||||
Ok(_resp) => {
|
||||
match api::wipe_data::coverart_queue::wipe_data(app, coverart_queue_id).await {
|
||||
match api::wipe_data::coverart_queue::wipe_data(app, queued_coverart).await {
|
||||
Ok(inner_response) => match inner_response
|
||||
.json::<api::wipe_data::coverart_queue::response::Response>()
|
||||
.await
|
||||
@@ -178,6 +181,9 @@ async fn some_work(
|
||||
user_id: &uuid::Uuid,
|
||||
) -> Result<
|
||||
(
|
||||
icarus_models::song::Song,
|
||||
icarus_models::coverart::CoverArt,
|
||||
api::get_metadata_queue::response::Metadata,
|
||||
queued_item::QueuedSong,
|
||||
queued_item::QueuedCoverArt
|
||||
),
|
||||
@@ -214,13 +220,12 @@ async fn some_work(
|
||||
};
|
||||
*/
|
||||
|
||||
match metadata::apply_metadata(&song_queue_path, &coverart_queue_path, &metadata).await
|
||||
match metadata::apply_metadata(&queued_song, &queued_coverart, &metadata).await
|
||||
{
|
||||
Ok(_applied) => {
|
||||
match api::update_queued_song::update_queued_song(
|
||||
app,
|
||||
&song_queue_path,
|
||||
song_queue_id,
|
||||
&queued_song,
|
||||
)
|
||||
.await
|
||||
{
|
||||
@@ -250,19 +255,19 @@ async fn some_work(
|
||||
println!("Response: {resp:?}");
|
||||
|
||||
let mut song = resp.data[0].clone();
|
||||
song.directory = song_directory;
|
||||
song.filename = song_filename;
|
||||
song.directory = queued_song.song.directory.clone();
|
||||
song.filename = queued_song.song.filename.clone();
|
||||
|
||||
match api::create_coverart::create(app, &song.id, &coverart_queue_id).await {
|
||||
match api::create_coverart::create(app, &song, &queued_coverart).await {
|
||||
Ok(response) => match response.json::<api::create_coverart::response::Response>().await {
|
||||
Ok(resp) => {
|
||||
println!("CoverArt sent and successfully parsed response");
|
||||
println!("json: {resp:?}");
|
||||
let mut coverart = resp.data[0].clone();
|
||||
coverart.directory = coverart_queue.directory;
|
||||
coverart.filename = coverart_queue.filename;
|
||||
coverart.directory = queued_coverart.coverart.directory.clone();
|
||||
coverart.filename = queued_coverart.coverart.filename.clone();
|
||||
|
||||
Ok((song.clone(), coverart.clone(), (metadata.song_queue_id, song_queue_path), (coverart_queue_id, coverart_queue_path)))
|
||||
Ok((song.clone(), coverart.clone(), metadata, queued_song.clone(), queued_coverart.clone()))
|
||||
}
|
||||
Err(err) => {
|
||||
Err(std::io::Error::other(err.to_string()))
|
||||
|
Reference in New Issue
Block a user