From 2b824a268b7a96bb9664cf5b1f22074401a8d93b Mon Sep 17 00:00:00 2001 From: phoenix Date: Tue, 21 Oct 2025 13:14:31 -0400 Subject: [PATCH 1/6] Using file_type passed when getting the CoverArtQueue --- src/api.rs | 1 + src/main.rs | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/api.rs b/src/api.rs index 7beaec0..ae4d756 100644 --- a/src/api.rs +++ b/src/api.rs @@ -158,6 +158,7 @@ pub mod get_coverart_queue { #[derive(Debug, Deserialize, Serialize)] pub struct CoverArtQueue { pub id: uuid::Uuid, + pub file_type: String, pub song_queue_id: uuid::Uuid, } diff --git a/src/main.rs b/src/main.rs index 5190565..5bb917b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -341,13 +341,14 @@ async fn prep_song( Ok(response) => { match response.json::().await { Ok(response) => { - let coverart_queue_id = &response.data[0].id; + let coverart_queue = &response.data[0]; + let coverart_queue_id = coverart_queue.id; println!("Coverart queue Id: {coverart_queue_id:?}"); - match api::get_coverart_queue::get_data(app, coverart_queue_id).await { + match api::get_coverart_queue::get_data(app, &coverart_queue_id).await { Ok(response) => match api::parsing::parse_response_into_bytes(response).await { Ok(coverart_queue_bytes) => { - let (directory, filename) = generate_coverart_queue_dir_and_filename().await; + let (directory, filename) = generate_coverart_queue_dir_and_filename(&coverart_queue.file_type).await; let coverart = icarus_models::coverart::CoverArt { directory, filename, @@ -367,7 +368,7 @@ async fn prep_song( let coverart_queue_path = std::path::Path::new(&coverart_queue_fs_path); println!("Saved coverart queue file at: {coverart_queue_path:?}"); - Ok(((song.directory, song.filename), (coverart.directory, coverart.filename), metadata.clone(), *coverart_queue_id)) + Ok(((song.directory, song.filename), (coverart.directory, coverart.filename), metadata.clone(), coverart_queue_id)) } Err(err) => { Err(err) @@ -413,7 +414,7 @@ pub async fn generate_song_queue_dir_and_filename() -> (String, String) { } // TODO: Consider having something like this in icarus_models -pub async fn generate_coverart_queue_dir_and_filename() -> (String, String) { +pub async fn generate_coverart_queue_dir_and_filename(file_type: &str) -> (String, String) { use rand::Rng; let mut filename: String = String::new(); @@ -432,8 +433,13 @@ pub async fn generate_coverart_queue_dir_and_filename() -> (String, String) { } } - // TODO: Do not hard code the file extension - filename += ".jpeg"; + filename += if file_type == "jpeg" || file_type == "jpg" { + ".jpeg" + } else if file_type == "png" { + ".png" + } else { + "" + }; // TODO: Consider separating song and coverart when saving to the filesystem let directory = icarus_envy::environment::get_root_directory().await.value; -- 2.43.0 From a22acb7c53018733d71fcae777d57f772094a900 Mon Sep 17 00:00:00 2001 From: phoenix Date: Tue, 21 Oct 2025 13:15:20 -0400 Subject: [PATCH 2/6] version bump --- Cargo.lock | 14 +++++++++++--- Cargo.toml | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b7ba8fc..5e627f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -498,10 +498,12 @@ dependencies = [ [[package]] name = "icarus_meta" -version = "0.4.0" -source = "git+ssh://git@git.kundeng.us/phoenix/icarus_meta.git?tag=v0.4.0#f372d059155691c0bac52594fa0d14867078e461" +version = "0.4.2" +source = "git+ssh://git@git.kundeng.us/phoenix/icarus_meta.git?tag=v0.4.2-main-71374eb731-680#71374eb73180966d11a7298df06fdc6e999c3c78" dependencies = [ + "imghdr", "lofty", + "rand", ] [[package]] @@ -625,6 +627,12 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "imghdr" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8b35f3ad95576ac81603375dfe47a0450b70a368aa34d2b6e5bb0a0d7f02428" + [[package]] name = "indexmap" version = "2.12.0" @@ -1293,7 +1301,7 @@ dependencies = [ [[package]] name = "songparser" -version = "0.4.3" +version = "0.4.4" dependencies = [ "futures", "icarus_envy", diff --git a/Cargo.toml b/Cargo.toml index a08daae..77a8bbd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "songparser" -version = "0.4.3" +version = "0.4.4" edition = "2024" rust-version = "1.90" @@ -13,6 +13,6 @@ serde_json = { version = "1.0.145" } time = { version = "0.3.44", features = ["macros", "serde"] } uuid = { version = "1.18.1", features = ["v4", "serde"] } rand = { version = "0.9.2" } -icarus_meta = { git = "ssh://git@git.kundeng.us/phoenix/icarus_meta.git", tag = "v0.4.0" } +icarus_meta = { git = "ssh://git@git.kundeng.us/phoenix/icarus_meta.git", tag = "v0.4.2-main-71374eb731-680" } icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.8.0" } icarus_envy = { git = "ssh://git@git.kundeng.us/phoenix/icarus_envy.git", tag = "v0.5.0" } -- 2.43.0 From 5384166830c210ea493e22ab77c5902bc89d916f Mon Sep 17 00:00:00 2001 From: phoenix Date: Tue, 21 Oct 2025 21:39:54 -0400 Subject: [PATCH 3/6] icarus_meta version bump --- Cargo.lock | 25 +++++++++++++++++++++++-- Cargo.toml | 2 +- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5e627f0..ae31321 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -69,6 +69,17 @@ dependencies = [ "shlex", ] +[[package]] +name = "cfb" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f" +dependencies = [ + "byteorder", + "fnv", + "uuid", +] + [[package]] name = "cfg-if" version = "1.0.4" @@ -498,10 +509,11 @@ dependencies = [ [[package]] name = "icarus_meta" -version = "0.4.2" -source = "git+ssh://git@git.kundeng.us/phoenix/icarus_meta.git?tag=v0.4.2-main-71374eb731-680#71374eb73180966d11a7298df06fdc6e999c3c78" +version = "0.4.3" +source = "git+ssh://git@git.kundeng.us/phoenix/icarus_meta.git?tag=v0.4.3-48-561d740120-680#561d740120d9d2e0224bff0c8a4d7d40c6230413" dependencies = [ "imghdr", + "infer", "lofty", "rand", ] @@ -645,6 +657,15 @@ dependencies = [ "serde_core", ] +[[package]] +name = "infer" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a588916bfdfd92e71cacef98a63d9b1f0d74d6599980d11894290e7ddefffcf7" +dependencies = [ + "cfb", +] + [[package]] name = "ipnet" version = "2.11.0" diff --git a/Cargo.toml b/Cargo.toml index 77a8bbd..30096de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,6 @@ serde_json = { version = "1.0.145" } time = { version = "0.3.44", features = ["macros", "serde"] } uuid = { version = "1.18.1", features = ["v4", "serde"] } rand = { version = "0.9.2" } -icarus_meta = { git = "ssh://git@git.kundeng.us/phoenix/icarus_meta.git", tag = "v0.4.2-main-71374eb731-680" } +icarus_meta = { git = "ssh://git@git.kundeng.us/phoenix/icarus_meta.git", tag = "v0.4.3-48-561d740120-680" } icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.8.0" } icarus_envy = { git = "ssh://git@git.kundeng.us/phoenix/icarus_envy.git", tag = "v0.5.0" } -- 2.43.0 From 22629657384b04f1bcb14df58633ce4ef972175c Mon Sep 17 00:00:00 2001 From: phoenix Date: Tue, 21 Oct 2025 22:16:27 -0400 Subject: [PATCH 4/6] icarus_meta version bump --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ae31321..08d4e67 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -510,7 +510,7 @@ dependencies = [ [[package]] name = "icarus_meta" version = "0.4.3" -source = "git+ssh://git@git.kundeng.us/phoenix/icarus_meta.git?tag=v0.4.3-48-561d740120-680#561d740120d9d2e0224bff0c8a4d7d40c6230413" +source = "git+ssh://git@git.kundeng.us/phoenix/icarus_meta.git?tag=v0.4.3-48-8acf220fc4-680#8acf220fc4a646090cfb54eff78aaa2f172bf882" dependencies = [ "imghdr", "infer", diff --git a/Cargo.toml b/Cargo.toml index 30096de..1c7b420 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,6 @@ serde_json = { version = "1.0.145" } time = { version = "0.3.44", features = ["macros", "serde"] } uuid = { version = "1.18.1", features = ["v4", "serde"] } rand = { version = "0.9.2" } -icarus_meta = { git = "ssh://git@git.kundeng.us/phoenix/icarus_meta.git", tag = "v0.4.3-48-561d740120-680" } +icarus_meta = { git = "ssh://git@git.kundeng.us/phoenix/icarus_meta.git", tag = "v0.4.3-48-8acf220fc4-680" } icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.8.0" } icarus_envy = { git = "ssh://git@git.kundeng.us/phoenix/icarus_envy.git", tag = "v0.5.0" } -- 2.43.0 From e80bf36852346dcfa5b6d7794f5d84d53dbf6949 Mon Sep 17 00:00:00 2001 From: phoenix Date: Tue, 21 Oct 2025 22:16:48 -0400 Subject: [PATCH 5/6] Replace code with constants --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5bb917b..19bc2f8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -433,9 +433,11 @@ pub async fn generate_coverart_queue_dir_and_filename(file_type: &str) -> (Strin } } - filename += if file_type == "jpeg" || file_type == "jpg" { + filename += if file_type == icarus_meta::detection::coverart::constants::JPEG_TYPE + || file_type == icarus_meta::detection::coverart::constants::JPG_TYPE + { ".jpeg" - } else if file_type == "png" { + } else if file_type == icarus_meta::detection::coverart::constants::PNG_TYPE { ".png" } else { "" -- 2.43.0 From 39249b8f81aaf90cd8cbd45ec6171addd1a5bba1 Mon Sep 17 00:00:00 2001 From: phoenix Date: Tue, 21 Oct 2025 22:33:05 -0400 Subject: [PATCH 6/6] icarus_meta version bump --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 08d4e67..f78343e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -510,7 +510,7 @@ dependencies = [ [[package]] name = "icarus_meta" version = "0.4.3" -source = "git+ssh://git@git.kundeng.us/phoenix/icarus_meta.git?tag=v0.4.3-48-8acf220fc4-680#8acf220fc4a646090cfb54eff78aaa2f172bf882" +source = "git+ssh://git@git.kundeng.us/phoenix/icarus_meta.git?tag=v0.4.3#c0607597f196eb71f8069f23c91359968ef639ad" dependencies = [ "imghdr", "infer", diff --git a/Cargo.toml b/Cargo.toml index 1c7b420..50c4c38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,6 @@ serde_json = { version = "1.0.145" } time = { version = "0.3.44", features = ["macros", "serde"] } uuid = { version = "1.18.1", features = ["v4", "serde"] } rand = { version = "0.9.2" } -icarus_meta = { git = "ssh://git@git.kundeng.us/phoenix/icarus_meta.git", tag = "v0.4.3-48-8acf220fc4-680" } +icarus_meta = { git = "ssh://git@git.kundeng.us/phoenix/icarus_meta.git", tag = "v0.4.3" } icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.8.0" } icarus_envy = { git = "ssh://git@git.kundeng.us/phoenix/icarus_envy.git", tag = "v0.5.0" } -- 2.43.0