diff --git a/src/core/collection/album.rs b/src/core/collection/album.rs index f872680..f27192a 100644 --- a/src/core/collection/album.rs +++ b/src/core/collection/album.rs @@ -6,6 +6,8 @@ use crate::core::collection::{ track::{Track, TrackFormat}, }; +use super::string; + /// An album is a collection of tracks that were released together. #[derive(Clone, Debug, PartialEq, Eq)] pub struct Album { @@ -314,7 +316,8 @@ impl AlbumId { } pub fn compatible(&self, other: &AlbumId) -> bool { - let titles_compatible = self.title == other.title; + let titles_compatible = + string::normalize_string(&self.title) == string::normalize_string(&other.title); let lib_id_compatible = self.lib_id.is_none() || other.lib_id.is_none() || (self.lib_id == other.lib_id); let mb_ref_compatible = diff --git a/src/core/collection/artist.rs b/src/core/collection/artist.rs index 3ab969d..91c2391 100644 --- a/src/core/collection/artist.rs +++ b/src/core/collection/artist.rs @@ -285,7 +285,8 @@ impl ArtistId { } pub fn compatible(&self, other: &ArtistId) -> bool { - let names_compatible = self.name == other.name; + let names_compatible = + string::normalize_string(&self.name) == string::normalize_string(&other.name); let mb_ref_compatible = self.mb_ref.is_none() || other.mb_ref.is_none() || (self.mb_ref == other.mb_ref); names_compatible && mb_ref_compatible diff --git a/src/core/collection/string.rs b/src/core/collection/string.rs index facd04f..7617c0f 100644 --- a/src/core/collection/string.rs +++ b/src/core/collection/string.rs @@ -54,6 +54,7 @@ pub fn normalize_string(string: &str) -> NormalString { #[cfg(test)] mod benches { // The purpose of these benches was to evaluate the benefit of AhoCorasick over std solutions. + // The winners are left to allow comparison with future alternatives. use test::Bencher; use crate::core::collection::benchmod::ARTISTS;