fixes #520 - Support multiple artists per audio track

This commit is contained in:
Luke Pulverenti 2013-09-05 15:00:50 -04:00
parent ee25e54186
commit e6bb8d236f
3 changed files with 51 additions and 9 deletions

View file

@ -238,8 +238,8 @@
$('#players', page).hide();
}
if ((item.Type == "Audio" || item.Type == "MusicVideo") && item.Artists && item.Artists.length) {
$('#artist', page).show().html('Artist:&nbsp;&nbsp;<a class="textlink" href="itembynamedetails.html?context=music&artist=' + ApiClient.encodeName(item.Artists[0]) + '">' + item.Artists[0] + '</a>').trigger('create');
if (item.Artists && item.Artists.length) {
$('#artist', page).show().html(getArtistLinksHtml(item.Artists)).trigger('create');
} else {
$('#artist', page).hide();
}
@ -260,6 +260,30 @@
$('.itemPath', page).hide();
}
}
function getArtistLinksHtml(artists) {
var html = [];
for (var i = 0, length = artists.length; i < length; i++) {
var artist = artists[i];
html.push('<a class="textlink" href="itembynamedetails.html?context=music&artist=' + ApiClient.encodeName(artist) + '">' + artist + '</a>');
}
html = html.join(' / ');
if (artists.length == 1) {
return 'Artist:&nbsp;&nbsp;' + html;
}
if (artists.length > 1) {
return 'Artists:&nbsp;&nbsp;' + html;
}
return html;
}
function renderSoundtracks(page, item) {