1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Show track artists in the list view, except if the artists for all tracks match the album artists

This commit is contained in:
Benoît Dardenne 2020-05-26 22:58:27 +02:00
parent e6c2f2ee08
commit 734b3dd382
2 changed files with 13 additions and 14 deletions

View file

@ -370,18 +370,8 @@ import 'emby-playstatebutton';
}
}
} else {
let showArtist = options.artist === true;
const artistItems = item.ArtistItems;
if (!showArtist && options.artist !== false) {
if (!artistItems || !artistItems.length) {
showArtist = true;
} else if (artistItems.length > 1 || !containerAlbumArtistIds.includes(artistItems[0].Id)) {
showArtist = true;
}
}
if (showArtist) {
if (options.artist) {
const artistItems = item.ArtistItems;
if (artistItems && item.Type !== 'MusicAlbum') {
textlines.push(artistItems.map(a => {
return a.Name;

View file

@ -1337,16 +1337,25 @@ function renderChildren(page, item) {
const childrenItemsContainer = page.querySelector('.childrenItemsContainer');
if (item.Type == 'MusicAlbum') {
const equalSet = (arr1, arr2) => arr1.every(x => arr2.indexOf(x) !== -1) && arr1.length === arr2.length;
let showArtist = false;
for (const track of result.Items) {
if (!equalSet(track.ArtistItems.map(x => x.Id), track.AlbumArtists.map(x => x.Id) )) {
showArtist = true;
break;
}
}
const discNumbers = result.Items.map(x => x.ParentIndexNumber);
html = listView.getListViewHtml({
items: result.Items,
smallIcon: true,
showIndex: true,
showIndex: new Set(discNumbers).size > 1 || (discNumbers.length >= 1 && discNumbers[0] > 1),
index: 'disc',
showIndexNumberLeft: true,
playFromHere: true,
action: 'playallfromhere',
image: false,
artist: 'auto',
artist: showArtist,
containerAlbumArtists: item.AlbumArtists
});
isList = true;