year one-liner for mp4 metadata

This commit is contained in:
Ray 2020-06-20 21:56:09 -04:00
parent f0fc9e8fba
commit 337a4020fe

View file

@ -225,8 +225,7 @@ fn read_mp4(path: &Path) -> Result<SongTags> {
tags.duration = tag.duration().map(|v| v as u32); tags.duration = tag.duration().map(|v| v as u32);
tags.disc_number = tag.disk_number().0.and_then(|d| Some(d as u32)); tags.disc_number = tag.disk_number().0.and_then(|d| Some(d as u32));
tags.track_number = tag.track_number().0.and_then(|d| Some(d as u32)); tags.track_number = tag.track_number().0.and_then(|d| Some(d as u32));
let year = tag.year().and_then(|v| Some(v.parse::<i32>().ok())); tags.year = tag.year().and_then(|v| v.parse::<i32>().ok());
tags.year = match year { None => None, Some(year) => year};
Ok(tags) Ok(tags)
} }