diff --git a/Cargo.toml b/Cargo.toml index c79e2c4..3f821c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,5 +14,5 @@ serde_json = { version = "1.0.150" } time = { version = "0.3.53", features = ["macros", "serde"] } uuid = { version = "1.23.4", features = ["v4", "serde"] } icarus_meta = { git = "ssh://git@git.kundeng.us/phoenix/icarus_meta.git", tag = "v0.6.1" } -icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.11.3" } +simodels = { git = "ssh://git@git.kundeng.us/phoenix/simodels.git", tag = "v0.11.3-main-fe9d101bd0-111" } icarus_envy = { git = "ssh://git@git.kundeng.us/phoenix/icarus_envy.git", tag = "v0.8.0" } diff --git a/src/api.rs b/src/api.rs index 32ccc8c..f1fdeda 100644 --- a/src/api.rs +++ b/src/api.rs @@ -162,7 +162,7 @@ pub mod service_token { #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct Response { pub message: String, - pub data: Vec, + pub data: Vec, } } } @@ -172,7 +172,7 @@ pub mod refresh_token { #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct Response { pub message: String, - pub data: Vec, + pub data: Vec, } } } @@ -253,7 +253,7 @@ pub mod create_song { #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct Response { pub message: String, - pub data: Vec, + pub data: Vec, } } } @@ -261,7 +261,7 @@ pub mod create_song { pub mod create_coverart { pub async fn create( app: &crate::config::App, - song: &icarus_models::song::Song, + song: &simodels::song::Song, queued_coverart: &crate::queued_item::QueuedCoverArt, ) -> Result { let client = reqwest::Client::builder().build()?; @@ -284,7 +284,7 @@ pub mod create_coverart { #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct Response { pub message: String, - pub data: Vec, + pub data: Vec, } } } diff --git a/src/auth/mod.rs b/src/auth/mod.rs index 15153cb..640f2d7 100644 --- a/src/auth/mod.rs +++ b/src/auth/mod.rs @@ -1,6 +1,6 @@ pub async fn get_token( app: &crate::config::App, -) -> Result { +) -> Result { let client = reqwest::Client::new(); let endpoint = String::from("api/v2/service/login"); let api_url = format!("{}/{endpoint}", app.auth_uri); @@ -29,7 +29,7 @@ pub async fn get_token( pub async fn get_refresh_token( app: &crate::config::App, -) -> Result { +) -> Result { let client = reqwest::Client::new(); let endpoint = String::from("api/v2/token/refresh"); let api_url = format!("{}/{endpoint}", app.auth_uri); diff --git a/src/config.rs b/src/config.rs index ed66cd1..b2e6a47 100644 --- a/src/config.rs +++ b/src/config.rs @@ -2,7 +2,7 @@ pub struct App { pub uri: String, pub auth_uri: String, - pub token: icarus_models::login_result::LoginResult, + pub token: simodels::login_result::LoginResult, pub root_directory: String, } diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 7b8ad8d..8f3bbee 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -4,8 +4,8 @@ pub async fn some_work( user_id: &uuid::Uuid, ) -> Result< ( - icarus_models::song::Song, - icarus_models::coverart::CoverArt, + simodels::song::Song, + simodels::coverart::CoverArt, crate::api::get_metadata_queue::response::Metadata, crate::queued_item::QueuedSong, crate::queued_item::QueuedCoverArt, @@ -104,10 +104,10 @@ pub async fn prep_song( // Process data here... match crate::api::parsing::parse_response_into_bytes(response).await { Ok(song_bytes) => { - let song = icarus_models::song::Song { + let song = simodels::song::Song { directory: icarus_envy::environment::get_root_directory().value, - filename: icarus_models::song::generate_filename( - icarus_models::types::MusicType::FlacExtension, + filename: simodels::song::generate_filename( + simodels::types::MusicType::FlacExtension, true, ) .unwrap(), @@ -224,17 +224,17 @@ async fn init_queued_coverart( ) -> crate::queued_item::QueuedCoverArt { // TODO: Consider separating song and coverart when saving to the filesystem let covart_type = if file_type == icarus_meta::detection::coverart::constants::PNG_TYPE { - icarus_models::types::CoverArtType::PngExtension + simodels::types::CoverArtType::PngExtension } else if file_type == icarus_meta::detection::coverart::constants::JPEG_TYPE { - icarus_models::types::CoverArtType::JpegExtension + simodels::types::CoverArtType::JpegExtension } else if file_type == icarus_meta::detection::coverart::constants::JPG_TYPE { - icarus_models::types::CoverArtType::JpgExtension + simodels::types::CoverArtType::JpgExtension } else { - icarus_models::types::CoverArtType::None + simodels::types::CoverArtType::None }; - let coverart = icarus_models::coverart::CoverArt { + let coverart = simodels::coverart::CoverArt { directory: icarus_envy::environment::get_root_directory().value, - filename: match icarus_models::coverart::generate_filename(covart_type, true) { + filename: match simodels::coverart::generate_filename(covart_type, true) { Ok(filename) => filename, Err(err) => { eprintln!("Error generating CoverArt filename: {err:?}"); @@ -255,8 +255,8 @@ async fn init_queued_coverart( } pub async fn cleanup( - song: &icarus_models::song::Song, - coverart: &icarus_models::coverart::CoverArt, + song: &simodels::song::Song, + coverart: &simodels::coverart::CoverArt, ) -> Result<(), std::io::Error> { match song.remove_from_filesystem() { Ok(_) => {} diff --git a/src/queued_item.rs b/src/queued_item.rs index 3c4e13b..f4026a9 100644 --- a/src/queued_item.rs +++ b/src/queued_item.rs @@ -1,13 +1,13 @@ #[derive(Clone, Debug, Default)] pub struct QueuedSong { pub id: uuid::Uuid, - pub song: icarus_models::song::Song, + pub song: simodels::song::Song, pub path: String, } #[derive(Clone, Debug, Default)] pub struct QueuedCoverArt { pub id: uuid::Uuid, - pub coverart: icarus_models::coverart::CoverArt, + pub coverart: simodels::coverart::CoverArt, pub path: String, }