Sort Grooveshark favorite songs according to "TSFavorited", as such songs have no "Sort" field.
BTW the compare was buggy (didn't compare against song2). This was OK though, as we stable sort songs, and they are always ordered as far as I know (I remember adding this sort just in case they will not be sent ordered on day).
This commit is contained in:
parent
fb5181a6e9
commit
4b48be4a5b
@ -1717,7 +1717,15 @@ QVariantMap GroovesharkService::ExtractResult(QNetworkReply* reply) {
|
||||
|
||||
namespace {
|
||||
bool CompareSongs(const QVariant& song1, const QVariant& song2) {
|
||||
return song1.toMap()["Sort"].toInt() < song1.toMap()["Sort"].toInt();
|
||||
QMap<QString, QVariant> song1_map = song1.toMap();
|
||||
QMap<QString, QVariant> song2_map = song2.toMap();
|
||||
int song1_sort = song1_map["Sort"].toInt();
|
||||
int song2_sort = song2_map["Sort"].toInt();
|
||||
if (song1_sort == song2_sort) {
|
||||
// Favorite songs have a "TSFavorited" and (currently) no "Sort" field
|
||||
return song1_map["TSFavorited"].toString() < song2_map["TSFavorited"].toString();
|
||||
}
|
||||
return song1_sort < song2_sort;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user