diff --git a/src/core/song.cpp b/src/core/song.cpp index 332a5c06..15c4a6ff 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -1372,12 +1372,14 @@ uint qHash(const Song &song) { } bool Song::IsSimilar(const Song &other) const { - return title().compare(other.title(), Qt::CaseInsensitive) == 0 && artist().compare(other.artist(), Qt::CaseInsensitive) == 0; + return title().compare(other.title(), Qt::CaseInsensitive) == 0 && + artist().compare(other.artist(), Qt::CaseInsensitive) == 0 && + album().compare(other.album(), Qt::CaseInsensitive) == 0; } uint HashSimilar(const Song &song) { // Should compare the same fields as function IsSimilar - return qHash(song.title().toLower()) ^ qHash(song.artist().toLower()); + return qHash(song.title().toLower()) ^ qHash(song.artist().toLower()) ^ qHash(song.album().toLower()); } bool Song::IsOnSameAlbum(const Song &other) const { diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 75fe95b7..30231395 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -1860,6 +1860,8 @@ void Playlist::RemoveDeletedSongs() { } +namespace { + struct SongSimilarHash { long operator() (const Song &song) const { return HashSimilar(song); @@ -1872,6 +1874,8 @@ struct SongSimilarEqual { } }; +} // namespace + void Playlist::RemoveDuplicateSongs() { QList rows_to_remove;