mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-02-09 16:28:54 +01:00
Don't treat songs with different album as duplicates
This commit is contained in:
parent
882f80de1e
commit
f81ecffda6
@ -1372,12 +1372,14 @@ uint qHash(const Song &song) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Song::IsSimilar(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;
|
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) {
|
uint HashSimilar(const Song &song) {
|
||||||
// Should compare the same fields as function IsSimilar
|
// 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 {
|
bool Song::IsOnSameAlbum(const Song &other) const {
|
||||||
|
@ -1860,6 +1860,8 @@ void Playlist::RemoveDeletedSongs() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
struct SongSimilarHash {
|
struct SongSimilarHash {
|
||||||
long operator() (const Song &song) const {
|
long operator() (const Song &song) const {
|
||||||
return HashSimilar(song);
|
return HashSimilar(song);
|
||||||
@ -1872,6 +1874,8 @@ struct SongSimilarEqual {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
void Playlist::RemoveDuplicateSongs() {
|
void Playlist::RemoveDuplicateSongs() {
|
||||||
|
|
||||||
QList<int> rows_to_remove;
|
QList<int> rows_to_remove;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user