From c7b3b3c7459be21de97a69a5515cd956bf75e227 Mon Sep 17 00:00:00 2001 From: Agatha Lovelace Date: Thu, 6 Oct 2022 15:13:09 +0200 Subject: [PATCH] Fix songs that incorrectly tag missing year as year 0 --- src/fetching.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fetching.rs b/src/fetching.rs index 5993a1e..00bcd3f 100644 --- a/src/fetching.rs +++ b/src/fetching.rs @@ -100,7 +100,10 @@ pub async fn index_source(source: Source, mode: IndexMode, db: &DatabaseConnecti album: Set(tags.and_then(|t| t.album()).map(|t| t.to_string())), genres: Set(tags.and_then(|t| t.genre()).map(|t| t.to_string())), track: Set(tags.and_then(|t| t.track()).map(|t| t as i32)), - year: Set(tags.and_then(|t| t.year()).map(|t| t as i32)), + year: Set(tags + .and_then(|t| t.year()) + .map(|t| if t == 0 { None } else { Some(t as i32) }) + .flatten()), duration: Set(properties .duration() .as_millis()