summaryrefslogtreecommitdiffstats
path: root/playerwidget.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2017-12-01 03:12:35 +0100
committerArno <arno@disconnect.de>2017-12-01 03:12:35 +0100
commit3cda8abf5e056b91a81497cf698470dfac607c6f (patch)
treea7a331be0ebfb5a3ba143c95dd413f65597faffe /playerwidget.cpp
parent8b611b7c69b50bf2f252903a849dd41ed685fece (diff)
downloadBeetPlayer-3cda8abf5e056b91a81497cf698470dfac607c6f.tar.gz
BeetPlayer-3cda8abf5e056b91a81497cf698470dfac607c6f.tar.bz2
BeetPlayer-3cda8abf5e056b91a81497cf698470dfac607c6f.zip
Improve Musicbrainz-Search
Filter out Live albums and compilations. Sort the resulting album list by release year. Unfortunately, musicbrainz does not always agree with the release year from the file metadata :(
Diffstat (limited to 'playerwidget.cpp')
-rw-r--r--playerwidget.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/playerwidget.cpp b/playerwidget.cpp
index 366ca78..0fb97ed 100644
--- a/playerwidget.cpp
+++ b/playerwidget.cpp
@@ -1483,13 +1483,20 @@ void PlayerWidget::webDlDone(){
text.append(QString("<tr><td style=\"padding-left: 30px\">Album</td><td style=\"padding-left: 30px\"><a href=\"https://musicbrainz.org/release-group/%1\">%2</a></td></tr>").arg(alId).arg(mWebDownloader->album()));
}
text.append("</table>");
- const QMap<QString, QString> other = mWebDownloader->otherData();
+ QList<QList<QVariant> > other = mWebDownloader->otherData();
+ std::sort(other.begin(), other.end(), [](auto a, auto b){
+ return a.at(2).toInt() < b.at(2).toInt();
+ });
text.append(QString(tr("<b>All Albums (%1):</b><ul>")).arg(QString::number(other.count())));
- QStringList albums = other.values();
- std::sort(albums.begin(), albums.end());
- foreach(QString a, albums){
- QString id = other.key(a);
- text.append(QString("<li><a href=\"https://musicbrainz.org/release-group/%1\">%2</a></li>").arg(id).arg(a));
+ foreach(const QVariant vl, other){
+ QVariantList cur = vl.toList();
+ QString id = cur.at(0).toString();
+ QString album = cur.at(1).toString();
+ QString year = cur.at(2).toString();
+ if(year == "-1"){
+ year = "nota";
+ }
+ text.append(QString("<li>%1: <a href=\"https://musicbrainz.org/release-group/%2\">%3</a></li>").arg(year).arg(id).arg(album));
}
text.append("</ul>");
}else{