From 3cda8abf5e056b91a81497cf698470dfac607c6f Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 1 Dec 2017 03:12:35 +0100 Subject: 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 :( --- playerwidget.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'playerwidget.cpp') 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("Album%2").arg(alId).arg(mWebDownloader->album())); } text.append(""); - const QMap other = mWebDownloader->otherData(); + QList > 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("All Albums (%1):
    ")).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("
  • %2
  • ").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("
  • %1: %3
  • ").arg(year).arg(id).arg(album)); } text.append("
"); }else{ -- cgit v1.2.3-70-g09d2