Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/agersant/polaris
Browse files Browse the repository at this point in the history
  • Loading branch information
agersant committed Jul 11, 2024
2 parents 11775d9 + 77dc2ea commit 138eacc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/app/index/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,13 @@ impl From<id3::Tag> for SongTags {
pub fn read(path: &Path) -> Option<SongTags> {
let data = match utils::get_audio_format(path) {
Some(AudioFormat::AIFF) => read_aiff(path),
Some(AudioFormat::APE) => read_ape(path),
Some(AudioFormat::FLAC) => read_flac(path),
Some(AudioFormat::MP3) => read_mp3(path),
Some(AudioFormat::MP4) => read_mp4(path),
Some(AudioFormat::MPC) => read_ape(path),
Some(AudioFormat::OGG) => read_vorbis(path),
Some(AudioFormat::OPUS) => read_opus(path),
Some(AudioFormat::WAVE) => read_wave(path),
Some(AudioFormat::APE) | Some(AudioFormat::MPC) => read_ape(path),
Some(AudioFormat::MP4) | Some(AudioFormat::M4B) => read_mp4(path),
None => return None,
};
match data {
Expand Down
5 changes: 2 additions & 3 deletions src/app/thumbnail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,13 @@ fn generate_thumbnail(image_path: &Path, options: &Options) -> Result<DynamicIma
fn read(image_path: &Path) -> Result<DynamicImage, Error> {
match get_audio_format(image_path) {
Some(AudioFormat::AIFF) => read_aiff(image_path),
Some(AudioFormat::APE) => read_ape(image_path),
Some(AudioFormat::FLAC) => read_flac(image_path),
Some(AudioFormat::MP3) => read_mp3(image_path),
Some(AudioFormat::MP4) => read_mp4(image_path),
Some(AudioFormat::MPC) => read_ape(image_path),
Some(AudioFormat::OGG) => read_vorbis(image_path),
Some(AudioFormat::OPUS) => read_opus(image_path),
Some(AudioFormat::WAVE) => read_wave(image_path),
Some(AudioFormat::APE) | Some(AudioFormat::MPC) => read_ape(image_path),
Some(AudioFormat::MP4) | Some(AudioFormat::M4B) => read_mp4(image_path),
None => image::open(image_path).map_err(|e| Error::Image(image_path.to_owned(), e)),
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub enum AudioFormat {
OGG,
OPUS,
WAVE,
M4B,
}

pub fn get_audio_format(path: &Path) -> Option<AudioFormat> {
Expand All @@ -46,6 +47,7 @@ pub fn get_audio_format(path: &Path) -> Option<AudioFormat> {
"ogg" => Some(AudioFormat::OGG),
"opus" => Some(AudioFormat::OPUS),
"wav" => Some(AudioFormat::WAVE),
"m4b" => Some(AudioFormat::M4B),
_ => None,
}
}
Expand Down

0 comments on commit 138eacc

Please sign in to comment.