More cleanup
This commit is contained in:
@@ -195,7 +195,7 @@ impl CommitManager {
|
||||
Err(err) => {
|
||||
eprintln!("Error generating song filename: {err:?}");
|
||||
utilities::checks::exit_program(-3);
|
||||
return
|
||||
return;
|
||||
}
|
||||
};
|
||||
match song.save_to_filesystem() {
|
||||
@@ -436,17 +436,11 @@ impl CommitManager {
|
||||
println!("Queued status updated");
|
||||
Ok(())
|
||||
}
|
||||
Err(err) => {
|
||||
Err(std::io::Error::other(err.to_string()))
|
||||
}
|
||||
Err(err) => Err(std::io::Error::other(err.to_string())),
|
||||
},
|
||||
Err(err) => {
|
||||
Err(std::io::Error::other(err.to_string()))
|
||||
}
|
||||
Err(err) => Err(std::io::Error::other(err.to_string())),
|
||||
},
|
||||
Err(err) => {
|
||||
Err(std::io::Error::other(err.to_string()))
|
||||
}
|
||||
Err(err) => Err(std::io::Error::other(err.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,7 +484,7 @@ impl CommitManager {
|
||||
}
|
||||
Ok(songs)
|
||||
}
|
||||
Err(_) => Err(std::io::Error::other("Songs not retrieved"))
|
||||
Err(_) => Err(std::io::Error::other("Songs not retrieved")),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -571,7 +565,9 @@ impl CommitManager {
|
||||
}
|
||||
}
|
||||
|
||||
Err(std::io::Error::other("CoverArt directory and filename not found"))
|
||||
Err(std::io::Error::other(
|
||||
"CoverArt directory and filename not found",
|
||||
))
|
||||
}
|
||||
|
||||
fn find_file_extension(&self, file_name: &std::ffi::OsString) -> En {
|
||||
|
||||
@@ -23,7 +23,6 @@ impl Default for TokenManager {
|
||||
user: icarus_models::user::User::default(),
|
||||
api: models::api::Api::default(),
|
||||
};
|
||||
|
||||
token.init();
|
||||
|
||||
token
|
||||
@@ -35,7 +34,6 @@ impl TokenManager {
|
||||
println!("Sending request for a token");
|
||||
|
||||
let url = self.retrieve_url();
|
||||
|
||||
println!("URL: {url}");
|
||||
|
||||
let mut token = icarus_models::token::AccessToken {
|
||||
@@ -62,19 +60,18 @@ impl TokenManager {
|
||||
token.token_type = login_result.token_type.clone();
|
||||
token.expiration = login_result.expiration;
|
||||
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 => {
|
||||
println!("Need to grab a new token");
|
||||
Err(std::io::Error::other("Need to grab a new token"))
|
||||
}
|
||||
other => {
|
||||
panic!("Uh oh! Something unexpected happened: {other:?}");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(token)
|
||||
}
|
||||
|
||||
pub fn init(&mut self) {
|
||||
@@ -84,10 +81,6 @@ impl TokenManager {
|
||||
}
|
||||
|
||||
pub fn retrieve_url(&self) -> String {
|
||||
let api = &self.api;
|
||||
let mut url = String::from(&api.url);
|
||||
url += &String::from(&api.endpoint);
|
||||
|
||||
url
|
||||
format!("{}{}", self.api.url, self.api.endpoint)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user