From c2e42ebf3ac4f668e72bb66b52ad073b191af6cf Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sun, 30 Mar 2025 00:34:43 +0100 Subject: [PATCH] Song: Include fingerprints in IsSimilar Fixes #1710 --- src/core/song.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/song.cpp b/src/core/song.cpp index 27d5ab239..a8cd8fe17 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -1029,8 +1029,10 @@ bool Song::IsOnSameAlbum(const Song &other) const { bool Song::IsSimilar(const Song &other) const { return title().compare(other.title(), Qt::CaseInsensitive) == 0 && - artist().compare(other.artist(), Qt::CaseInsensitive) == 0 && - album().compare(other.album(), Qt::CaseInsensitive) == 0; + artist().compare(other.artist(), Qt::CaseInsensitive) == 0 && + album().compare(other.album(), Qt::CaseInsensitive) == 0 && + fingerprint().compare(other.fingerprint()) == 0 && + acoustid_fingerprint().compare(other.acoustid_fingerprint()) == 0; } Song::Source Song::SourceFromURL(const QUrl &url) { @@ -1917,7 +1919,7 @@ size_t qHash(const Song &song) { size_t HashSimilar(const Song &song) { // Should compare the same fields as function IsSimilar - return qHash(song.title().toLower()) ^ qHash(song.artist().toLower()) ^ qHash(song.album().toLower()); + return qHash(song.title().toLower()) ^ qHash(song.artist().toLower()) ^ qHash(song.album().toLower()) ^ qHash(song.fingerprint()) ^ qHash(song.acoustid_fingerprint()); } bool Song::ContainsRegexList(const QString &str, const RegularExpressionList ®ex_list) {