More changes
This commit is contained in:
@@ -472,8 +472,12 @@ impl CommitManager {
|
||||
panic!("Directory does not exist");
|
||||
}
|
||||
|
||||
let coverart_path = match self.get_cover_art_path(&sourcepath) {
|
||||
Ok(path) => path,
|
||||
Err(_) => String::new(),
|
||||
};
|
||||
let mut cover_art =
|
||||
icarus_models::coverart::init::init_coverart_only_path(sourcepath.clone());
|
||||
icarus_models::coverart::init::init_coverart_only_path(coverart_path.clone());
|
||||
let metadatapath = match self.get_metadata_path(&sourcepath) {
|
||||
Ok(o) => o,
|
||||
Err(_) => String::new(),
|
||||
@@ -511,6 +515,30 @@ impl CommitManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_cover_art_path(&self, directory_path: &String) -> Result<String> {
|
||||
for entry in read_dir(std::path::Path::new(directory_path))? {
|
||||
let entry = entry?;
|
||||
|
||||
let file_type = entry.file_type();
|
||||
let file_name = entry.file_name();
|
||||
|
||||
println!("file type: {:?}", file_type);
|
||||
println!("file name: {:?}", file_name);
|
||||
|
||||
match self.find_file_extension(&file_name) {
|
||||
En::ImageFile => {
|
||||
let directory_part = directory_path.clone();
|
||||
let fname = utilities::string::o_to_string(&file_name);
|
||||
let fullpath = directory_part + "/" + &fname.unwrap();
|
||||
return Ok(fullpath);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(String::new())
|
||||
}
|
||||
|
||||
fn find_file_extension(&self, file_name: &std::ffi::OsString) -> En {
|
||||
let file_name_str = Some(file_name.clone().into_string());
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ impl Upload {
|
||||
cover: &icarus_models::coverart::CoverArt,
|
||||
) -> Result<reqwest::Response, reqwest::Error> {
|
||||
self.api.endpoint = String::from("song/data/upload/with/data");
|
||||
let url = syncers::common::retrieve_url(&self.api, false, &uuid::Uuid::new_v4());
|
||||
let url = syncers::common::retrieve_url(&self.api, false, &uuid::Uuid::nil());
|
||||
let access_token = token.bearer_token();
|
||||
|
||||
if url.is_empty() {
|
||||
|
||||
@@ -23,7 +23,7 @@ impl Checks {
|
||||
index += 1;
|
||||
}
|
||||
|
||||
return index;
|
||||
index
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user