From 63c45d3640ec09fcdcd44657fe4d1ddee885a705 Mon Sep 17 00:00:00 2001 From: "craig.p.drummond" Date: Tue, 17 Jun 2014 16:53:17 +0000 Subject: [PATCH] Order genres, so that comparison works --- mpd/mpdparseutils.cpp | 1 + mpd/song.cpp | 9 +++++++++ mpd/song.h | 1 + 3 files changed, 11 insertions(+) diff --git a/mpd/mpdparseutils.cpp b/mpd/mpdparseutils.cpp index 9e0684f79..6ee5951fe 100644 --- a/mpd/mpdparseutils.cpp +++ b/mpd/mpdparseutils.cpp @@ -318,6 +318,7 @@ Song MPDParseUtils::parseSong(const QList &lines, Location location) if (Loc_Library==location) { song.guessTags(); song.fillEmptyFields(); + song.orderGenres(); } else if (Loc_Streams==location) { song.setName(getAndRemoveStreamName(song.file)); } else { diff --git a/mpd/song.cpp b/mpd/song.cpp index b777a4c45..196d77a1e 100644 --- a/mpd/song.cpp +++ b/mpd/song.cpp @@ -418,6 +418,15 @@ QStringList Song::genres() const return genre.split(constGenreSep, QString::SkipEmptyParts); } +void Song::orderGenres() +{ + QStringList g=genres(); + if (g.count()>1) { + qSort(g); + genre=g.join(QString()+constGenreSep); + } +} + QString Song::entryName() const { if (title.isEmpty()) { diff --git a/mpd/song.h b/mpd/song.h index eff47a92b..26aa9feca 100644 --- a/mpd/song.h +++ b/mpd/song.h @@ -117,6 +117,7 @@ struct Song virtual void clear(); void addGenre(const QString &g); QStringList genres() const; + void orderGenres(); QString entryName() const; QString artistOrComposer() const; QString albumName() const;