Merge pull request #1308 from bendardenne/artist-in-album-view

Revisit showing track artists in album view
This commit is contained in:
dkanada 2020-08-31 18:07:05 +09:00 committed by GitHub
commit c09e31d79f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;