icarus_models version bump #93

Merged
kdeng00 merged 7 commits from icarus_models_bump into main 2025-10-30 15:33:09 -04:00
4 changed files with 35 additions and 51 deletions
Generated
+3 -3
View File
@@ -451,7 +451,7 @@ dependencies = [
[[package]] [[package]]
name = "icarus-dm" name = "icarus-dm"
version = "0.8.10" version = "0.8.11"
dependencies = [ dependencies = [
"futures", "futures",
"http", "http",
@@ -466,8 +466,8 @@ dependencies = [
[[package]] [[package]]
name = "icarus_models" name = "icarus_models"
version = "0.8.3" version = "0.9.2"
source = "git+ssh://git@git.kundeng.us/phoenix/icarus_models.git?tag=v0.8.3#0a27b8ccb1ac40361df8d3131f567f37f06cdc08" source = "git+ssh://git@git.kundeng.us/phoenix/icarus_models.git?tag=v0.9.2#05525618514409101c1d6474dafb201386d14a30"
dependencies = [ dependencies = [
"josekit", "josekit",
"rand", "rand",
+2 -2
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "icarus-dm" name = "icarus-dm"
version = "0.8.10" version = "0.8.11"
rust-version = "1.90" rust-version = "1.90"
edition = "2024" edition = "2024"
@@ -14,4 +14,4 @@ serde_json = "1.0.145"
tokio = { version = "1.47.1", features = ["full"] } tokio = { version = "1.47.1", features = ["full"] }
tokio-util = { version = "0.7.16", features = ["codec"] } tokio-util = { version = "0.7.16", features = ["codec"] }
uuid = { version = "1.18.1", features = ["v4", "serde"] } uuid = { version = "1.18.1", features = ["v4", "serde"] }
icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.8.3" } icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.9.2" }
+25 -34
View File
@@ -131,7 +131,7 @@ impl CommitManager {
} }
fn map_actions(&self) -> HashMap<String, ActionValues> { fn map_actions(&self) -> HashMap<String, ActionValues> {
let actions: HashMap<String, ActionValues> = HashMap::from([ HashMap::from([
("download".to_string(), ActionValues::DownloadAct), ("download".to_string(), ActionValues::DownloadAct),
("download".to_string(), ActionValues::DownloadAct), ("download".to_string(), ActionValues::DownloadAct),
( (
@@ -140,9 +140,7 @@ impl CommitManager {
), ),
("retrieve".to_string(), ActionValues::RetrieveAct), ("retrieve".to_string(), ActionValues::RetrieveAct),
("delete".to_string(), ActionValues::DeleteAct), ("delete".to_string(), ActionValues::DeleteAct),
]); ])
actions
} }
async fn delete_song(&self, token: &icarus_models::token::AccessToken) { async fn delete_song(&self, token: &icarus_models::token::AccessToken) {
@@ -189,10 +187,17 @@ impl CommitManager {
song.data = o.as_bytes().to_vec(); song.data = o.as_bytes().to_vec();
song.directory = String::from("."); song.directory = String::from(".");
song.filename = icarus_models::song::generate_filename( song.filename = match icarus_models::song::generate_filename(
icarus_models::types::MusicTypes::FlacExtension, icarus_models::types::MusicType::FlacExtension,
true, true,
); ) {
Ok(filename) => filename,
Err(err) => {
eprintln!("Error generating song filename: {err:?}");
utilities::checks::exit_program(-3);
return;
}
};
match song.save_to_filesystem() { match song.save_to_filesystem() {
Ok(_) => { Ok(_) => {
println!("Song saved"); println!("Song saved");
@@ -300,7 +305,7 @@ impl CommitManager {
} else if multitarget { } else if multitarget {
let _ = self.multi_target_upload(&uni, token).await; let _ = self.multi_target_upload(&uni, token).await;
} else { } else {
println!("Single or Multi target has not been chosen"); eprintln!("Single or Multi target has not been chosen");
} }
} }
@@ -429,21 +434,14 @@ impl CommitManager {
println!("Queued coverart Id: {id:?}"); println!("Queued coverart Id: {id:?}");
println!("Linked queued song to queued coverart"); println!("Linked queued song to queued coverart");
println!("Queued status updated"); println!("Queued status updated");
Ok(())
} }
Err(err) => { Err(err) => Err(std::io::Error::other(err.to_string())),
return Err(std::io::Error::other(err.to_string()));
}
}, },
Err(err) => { Err(err) => Err(std::io::Error::other(err.to_string())),
return Err(std::io::Error::other(err.to_string()));
}
}, },
Err(err) => { Err(err) => Err(std::io::Error::other(err.to_string())),
return Err(std::io::Error::other(err.to_string()));
}
} }
Ok(())
} }
fn get_songs( fn get_songs(
@@ -486,7 +484,7 @@ impl CommitManager {
} }
Ok(songs) Ok(songs)
} }
Err(_) => Ok(Vec::new()), Err(_) => Err(std::io::Error::other("Songs not retrieved")),
} }
} }
@@ -531,7 +529,7 @@ impl CommitManager {
println!("Response: {o:?}"); println!("Response: {o:?}");
} }
Err(err) => { Err(err) => {
println!("Error: {err:?}"); eprintln!("Error: {err:?}");
return Err(err); return Err(err);
} }
} }
@@ -540,12 +538,12 @@ impl CommitManager {
Ok(()) Ok(())
} }
Err(err) => { Err(err) => {
println!("Error: {err:?}"); eprintln!("Error: {err:?}");
Err(std::io::Error::other(err.to_string())) Err(std::io::Error::other(err.to_string()))
} }
}, },
Err(error) => { Err(error) => {
println!("Error: {error:?}"); eprintln!("Error: {error:?}");
Err(std::io::Error::other(error.to_string())) Err(std::io::Error::other(error.to_string()))
} }
} }
@@ -567,7 +565,9 @@ impl CommitManager {
} }
} }
Ok((String::new(), String::new())) Err(std::io::Error::other(
"CoverArt directory and filename not found",
))
} }
fn find_file_extension(&self, file_name: &std::ffi::OsString) -> En { fn find_file_extension(&self, file_name: &std::ffi::OsString) -> En {
@@ -635,15 +635,6 @@ impl CommitManager {
} }
} }
Ok(String::new()) Err(std::io::Error::other("Metadata path not found"))
}
fn _check_for_no_confirm(&self) -> bool {
for flag in self.ica_action.flags.iter() {
if flag.flag == "-nc" {
return true;
}
}
false
} }
} }
+5 -12
View File
@@ -23,7 +23,6 @@ impl Default for TokenManager {
user: icarus_models::user::User::default(), user: icarus_models::user::User::default(),
api: models::api::Api::default(), api: models::api::Api::default(),
}; };
token.init(); token.init();
token token
@@ -35,7 +34,6 @@ impl TokenManager {
println!("Sending request for a token"); println!("Sending request for a token");
let url = self.retrieve_url(); let url = self.retrieve_url();
println!("URL: {url}"); println!("URL: {url}");
let mut token = icarus_models::token::AccessToken { let mut token = icarus_models::token::AccessToken {
@@ -62,19 +60,18 @@ impl TokenManager {
token.token_type = login_result.token_type.clone(); token.token_type = login_result.token_type.clone();
token.expiration = login_result.expiration; token.expiration = login_result.expiration;
token.message = response.message; token.message = response.message;
Ok(token)
} }
Err(_) => println!("Hm, the response didn't match the shape we expected."), Err(err) => Err(std::io::Error::other(err.to_string())),
}; }
} }
reqwest::StatusCode::UNAUTHORIZED => { reqwest::StatusCode::UNAUTHORIZED => {
println!("Need to grab a new token"); Err(std::io::Error::other("Need to grab a new token"))
} }
other => { other => {
panic!("Uh oh! Something unexpected happened: {other:?}"); panic!("Uh oh! Something unexpected happened: {other:?}");
} }
} }
Ok(token)
} }
pub fn init(&mut self) { pub fn init(&mut self) {
@@ -84,10 +81,6 @@ impl TokenManager {
} }
pub fn retrieve_url(&self) -> String { pub fn retrieve_url(&self) -> String {
let api = &self.api; format!("{}{}", self.api.url, self.api.endpoint)
let mut url = String::from(&api.url);
url += &String::from(&api.endpoint);
url
} }
} }