Fix noticing of tag chages when MPD database is updated. When comparing songs need to check all fields - not just filename!
This commit is contained in:
@@ -76,6 +76,8 @@
|
||||
workaround applied - revert this before requesting data.
|
||||
48. When reading mpd.conf file, if bind_to_address is set to "any", then use
|
||||
default of "locahost".
|
||||
49. Fix noticing of tag chages when MPD database is updated. When comparing
|
||||
songs need to check all fields - not just filename!
|
||||
|
||||
0.7.1
|
||||
-----
|
||||
|
||||
38
mpd/song.cpp
38
mpd/song.cpp
@@ -75,41 +75,57 @@ Song & Song::operator=(const Song &s)
|
||||
|
||||
bool Song::operator==(const Song &o) const
|
||||
{
|
||||
return file == o.file;
|
||||
return 0==compareTo(o);
|
||||
}
|
||||
|
||||
bool Song::operator<(const Song &o) const
|
||||
{
|
||||
return compareTo(o)<0;
|
||||
}
|
||||
|
||||
int Song::compareTo(const Song &o) const
|
||||
{
|
||||
bool sortDateBeforeAlbum=MusicLibraryItemAlbum::showDate();
|
||||
int compare=albumArtist().localeAwareCompare(o.albumArtist());
|
||||
|
||||
if (0!=compare) {
|
||||
return compare<0;
|
||||
return compare;
|
||||
}
|
||||
if (sortDateBeforeAlbum && year!=o.year) {
|
||||
return year<o.year;
|
||||
return year<o.year ? -1 : 1;
|
||||
}
|
||||
compare=album.localeAwareCompare(o.album);
|
||||
if (0!=compare) {
|
||||
return compare<0;
|
||||
return compare;
|
||||
}
|
||||
if (!sortDateBeforeAlbum && year!=o.year) {
|
||||
return year<o.year;
|
||||
return year<o.year ? -1 : 1;
|
||||
}
|
||||
if (disc!=o.disc) {
|
||||
return disc<o.disc;
|
||||
return disc<o.disc ? -1 : 1;
|
||||
}
|
||||
if (type!=o.type) {
|
||||
return type<o.type;
|
||||
return type<o.type ? -1 : 1;
|
||||
}
|
||||
if (track!=o.track) {
|
||||
return track<o.track;
|
||||
return track<o.track ? -1 : 1;
|
||||
}
|
||||
compare=file.compare(o.file);
|
||||
if (time!=o.time) {
|
||||
return time<o.time ? -1 : 1;
|
||||
}
|
||||
compare=title.localeAwareCompare(o.title);
|
||||
if (0!=compare) {
|
||||
return compare<0;
|
||||
return compare;
|
||||
}
|
||||
return time<o.time;
|
||||
compare=name.compare(o.name);
|
||||
if (0!=compare) {
|
||||
return compare;
|
||||
}
|
||||
compare=genre.compare(o.genre);
|
||||
if (0!=compare) {
|
||||
return compare;
|
||||
}
|
||||
return file.compare(o.file);
|
||||
}
|
||||
|
||||
bool Song::isEmpty() const
|
||||
|
||||
@@ -83,6 +83,7 @@ struct Song
|
||||
Song & operator=(const Song &o);
|
||||
bool operator==(const Song &o) const;
|
||||
bool operator<(const Song &o) const;
|
||||
int compareTo(const Song &o) const;
|
||||
virtual ~Song() { }
|
||||
bool isEmpty() const;
|
||||
void fillEmptyFields();
|
||||
@@ -111,7 +112,7 @@ Q_DECLARE_METATYPE(Song)
|
||||
|
||||
inline uint qHash(const Song &key)
|
||||
{
|
||||
return qHash(key.file);
|
||||
return qHash(key.albumArtist()+key.album+key.title+key.file);
|
||||
}
|
||||
|
||||
inline uint qHash(const Song::AlbumKey &key)
|
||||
|
||||
Reference in New Issue
Block a user