Skip to content

Commit

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

// 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++) {
// Fallback to track artists.
if (artistNames.length === 0 && 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
}
}

if (artistNames.length > 0) {
$('#popupShowInfo #artist-cell').text(artistNames)
$('#popupShowInfo #artist-row').show()
Expand All @@ -382,7 +383,7 @@
} else {
$('#popupShowInfo #track-no-row').hide()
}
if (track.duration) {
if (track.length) {
var duration = new Date(track.length)
$('#popupShowInfo #length-cell').text(duration.getUTCMinutes() + ':' + duration.getUTCSeconds())
$('#popupShowInfo #length-row').show()
Expand Down

0 comments on commit 4f9e370

Please sign in to comment.