Skip to content

Commit

Permalink
Use track artist before falling back to album artist.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcass77 committed Jan 14, 2017
1 parent 4f9e370 commit dfffcbf
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions mopidy_musicbox_webclient/static/js/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,25 +352,24 @@
$('#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 (track.artists && track.artists.length > 0) {
for (var i = 0; i < track.artists.length; i++) {
if (i > 0) {
artistNames = artistNames + ', '
}
artistNames = artistNames + track.album.artists[i].name
artistNames = artistNames + track.artists[i].name
}
}

// Fallback to track artists.
if (artistNames.length === 0 && track.artists && track.artists.length > 0) {
for (var i = 0; i < track.artists.length; i++) {
// 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.artists[i].name
artistNames = artistNames + track.album.artists[i].name
}
}

if (artistNames.length > 0) {
$('#popupShowInfo #artist-cell').text(artistNames)
$('#popupShowInfo #artist-row').show()
Expand Down

0 comments on commit dfffcbf

Please sign in to comment.