Fix track duration check.
Use album artist before falling back to track artist.
This commit is contained in:
parent
8b895f1e2b
commit
4f9e370a45
23
mopidy_musicbox_webclient/static/js/controls.js
vendored
23
mopidy_musicbox_webclient/static/js/controls.js
vendored
@ -352,7 +352,17 @@
|
|||||||
$('#popupShowInfo #album-cell').text('(Not available)')
|
$('#popupShowInfo #album-cell').text('(Not available)')
|
||||||
}
|
}
|
||||||
var artistNames = ''
|
var artistNames = ''
|
||||||
if (track.artists && track.artists.length > 0) {
|
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) {
|
||||||
for (var i = 0; i < track.artists.length; i++) {
|
for (var i = 0; i < track.artists.length; i++) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
artistNames = artistNames + ', '
|
artistNames = artistNames + ', '
|
||||||
@ -361,15 +371,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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) {
|
if (artistNames.length > 0) {
|
||||||
$('#popupShowInfo #artist-cell').text(artistNames)
|
$('#popupShowInfo #artist-cell').text(artistNames)
|
||||||
$('#popupShowInfo #artist-row').show()
|
$('#popupShowInfo #artist-row').show()
|
||||||
@ -382,7 +383,7 @@
|
|||||||
} else {
|
} else {
|
||||||
$('#popupShowInfo #track-no-row').hide()
|
$('#popupShowInfo #track-no-row').hide()
|
||||||
}
|
}
|
||||||
if (track.duration) {
|
if (track.length) {
|
||||||
var duration = new Date(track.length)
|
var duration = new Date(track.length)
|
||||||
$('#popupShowInfo #length-cell').text(duration.getUTCMinutes() + ':' + duration.getUTCSeconds())
|
$('#popupShowInfo #length-cell').text(duration.getUTCMinutes() + ':' + duration.getUTCSeconds())
|
||||||
$('#popupShowInfo #length-row').show()
|
$('#popupShowInfo #length-row').show()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user