mirror of
https://github.com/agersant/polaris
synced 2024-11-10 10:14:12 +00:00
Don't emit errors on critical path
This commit is contained in:
parent
1764f3da4d
commit
b8b3c80be9
2 changed files with 17 additions and 8 deletions
|
@ -144,7 +144,7 @@ impl IndexUpdater {
|
|||
}
|
||||
|
||||
if let Some(file_path_string) = file_path.to_str() {
|
||||
if let Ok(tags) = metadata::read(file_path.as_path()) {
|
||||
if let Some(tags) = metadata::read(file_path.as_path()) {
|
||||
if tags.year.is_some() {
|
||||
inconsistent_directory_year |=
|
||||
directory_year.is_some() && directory_year != tags.year;
|
||||
|
|
|
@ -2,6 +2,7 @@ use anyhow::*;
|
|||
use ape;
|
||||
use id3;
|
||||
use lewton::inside_ogg::OggStreamReader;
|
||||
use log::error;
|
||||
use metaflac;
|
||||
use mp3_duration;
|
||||
use regex::Regex;
|
||||
|
@ -24,13 +25,21 @@ pub struct SongTags {
|
|||
}
|
||||
|
||||
#[cfg_attr(feature = "profile-index", flame)]
|
||||
pub fn read(path: &Path) -> Result<SongTags> {
|
||||
match utils::get_audio_format(path) {
|
||||
Some(AudioFormat::FLAC) => read_flac(path),
|
||||
Some(AudioFormat::MP3) => read_id3(path),
|
||||
Some(AudioFormat::MPC) => read_ape(path),
|
||||
Some(AudioFormat::OGG) => read_vorbis(path),
|
||||
_ => bail!("Unsupported file format for reading metadata"),
|
||||
pub fn read(path: &Path) -> Option<SongTags> {
|
||||
let data = match utils::get_audio_format(path) {
|
||||
Some(AudioFormat::FLAC) => Some(read_flac(path)),
|
||||
Some(AudioFormat::MP3) => Some(read_id3(path)),
|
||||
Some(AudioFormat::MPC) => Some(read_ape(path)),
|
||||
Some(AudioFormat::OGG) => Some(read_vorbis(path)),
|
||||
_ => None,
|
||||
};
|
||||
match data {
|
||||
Some(Ok(d)) => Some(d),
|
||||
Some(Err(e)) => {
|
||||
error!("Error while reading file metadata for '{:?}': {}", path, e);
|
||||
None
|
||||
}
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue