Fixed a bug where mp3 file durations were not read

This commit is contained in:
Antoine Gersant 2017-12-10 19:41:12 -08:00
parent a3defb8700
commit abc401ce06

View file

@ -34,9 +34,8 @@ pub fn read(path: &Path) -> Result<SongTags> {
}
fn read_id3(path: &Path) -> Result<SongTags> {
let file = fs::File::open(path)?;
let tag = id3::Tag::read_from(&file)?;
let duration = mp3_duration::from_file(&file).map(|d| d.as_secs() as u32).ok();
let tag = id3::Tag::read_from_path(&path)?;
let duration = mp3_duration::from_path(&path).map(|d| d.as_secs() as u32).ok();
let artist = tag.artist().map(|s| s.to_string());
let album_artist = tag.album_artist().map(|s| s.to_string());