mirror of
https://github.com/Dangoware/dmp-core.git
synced 2025-04-19 17:42:55 -05:00
Added .exists()
for URI
This commit is contained in:
parent
4a7a6096d6
commit
96069fd9bc
1 changed files with 10 additions and 4 deletions
|
@ -460,6 +460,14 @@ impl URI {
|
||||||
};
|
};
|
||||||
path_str.to_string()
|
path_str.to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn exists(&self) -> Result<bool, std::io::Error> {
|
||||||
|
match self {
|
||||||
|
URI::Local(loc) => loc.try_exists(),
|
||||||
|
URI::Cue {location, ..} => location.try_exists(),
|
||||||
|
URI::Remote(_, _loc) => todo!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToString for URI {
|
impl ToString for URI {
|
||||||
|
@ -699,7 +707,7 @@ impl MusicLibrary {
|
||||||
Ok(_) => total += 1,
|
Ok(_) => total += 1,
|
||||||
Err(_error) => {
|
Err(_error) => {
|
||||||
errors += 1;
|
errors += 1;
|
||||||
println!("{}, {:?}: {}", format, target_file.file_name(), _error)
|
//println!("{}, {:?}: {}", format, target_file.file_name(), _error)
|
||||||
} // TODO: Handle more of these errors
|
} // TODO: Handle more of these errors
|
||||||
};
|
};
|
||||||
} else if extension == "cue" {
|
} else if extension == "cue" {
|
||||||
|
@ -707,15 +715,13 @@ impl MusicLibrary {
|
||||||
Ok(added) => added,
|
Ok(added) => added,
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
errors += 1;
|
errors += 1;
|
||||||
println!("{}", error);
|
//println!("{}", error);
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("ERRORS: {}", errors);
|
|
||||||
|
|
||||||
Ok(total)
|
Ok(total)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue