INNER CODE UNIT · Rust
read_tagged_file
xiaobaimc/myune_music · rust/src/api/audio_info.rs:40
fn read_tagged_file(path: &Path, options: &AudioInfoOptions) -> Result<TaggedFile, String> {
// read_from_path
if let Ok(file) = read_from_path(path) {
let has_tag = file.primary_tag().is_some() || !file.tags().is_empty();
let has_cover = !options.need_cover
|| file
.primary_tag()
.and_then(|t| t.pictures().first())
.is_some();
if has_tag && has_cover {
return Ok(file);
}
}
// Relaxed Probe
Probe::open(path)
.map_err(|e| e.to_string())?