From dfffcbf1767ef09f8efc4f923d6ac070db778e7e Mon Sep 17 00:00:00 2001 From: jcass Date: Sat, 14 Jan 2017 11:40:13 +0200 Subject: [PATCH] Use track artist before falling back to album artist. --- .../static/js/controls.js | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/mopidy_musicbox_webclient/static/js/controls.js b/mopidy_musicbox_webclient/static/js/controls.js index 32d4806..d379068 100644 --- a/mopidy_musicbox_webclient/static/js/controls.js +++ b/mopidy_musicbox_webclient/static/js/controls.js @@ -352,17 +352,7 @@ $('#popupShowInfo #album-cell').text('(Not available)') } var artistNames = '' - if (track.album.artists && track.album.artists.length > 0) { - for (i = 0; i < track.album.artists.length; i++) { - if (i > 0) { - artistNames = artistNames + ', ' - } - artistNames = artistNames + track.album.artists[i].name - } - } - - // Fallback to track artists. - if (artistNames.length === 0 && track.artists && track.artists.length > 0) { + if (track.artists && track.artists.length > 0) { for (var i = 0; i < track.artists.length; i++) { if (i > 0) { artistNames = artistNames + ', ' @@ -371,6 +361,15 @@ } } + // Fallback to album artists. + if (artistNames.length === 0 && track.album.artists && track.album.artists.length > 0) { + for (i = 0; i < track.album.artists.length; i++) { + if (i > 0) { + artistNames = artistNames + ', ' + } + artistNames = artistNames + track.album.artists[i].name + } + } if (artistNames.length > 0) { $('#popupShowInfo #artist-cell').text(artistNames) $('#popupShowInfo #artist-row').show()