Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple attempt at adding song listing to artist page #6410

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components/listview/listview.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,9 @@ export function getListViewHtml(options) {
}).join(', '));
}
}
if (options.album && item.Type === 'Audio' && item.Album) {
textlines.push(item.Album);
}

if (item.Type === 'TvChannel' && item.CurrentProgram) {
textlines.push(itemHelper.getDisplayName(item.CurrentProgram));
Expand Down
47 changes: 41 additions & 6 deletions src/controllers/itemDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ function setInitialCollapsibleState(page, item, apiClient, context, user) {

renderScenes(page, item);

if (item.SpecialFeatureCount > 0) {
if (item.SpecialFeatureCount > 0 || item.Type == 'MusicArtist') {
theevilapplepie marked this conversation as resolved.
Show resolved Hide resolved
page.querySelector('#specialsCollapsible').classList.remove('hide');
renderSpecials(page, item, user);
} else {
Expand Down Expand Up @@ -1829,14 +1829,49 @@ function getVideosHtml(items) {
});
}

function renderSpecials(page, item, user) {
ServerConnections.getApiClient(item.ServerId).getSpecialFeatures(user.Id, item.Id).then(function (specials) {
const specialsContent = page.querySelector('#specialsContent');
specialsContent.innerHTML = getVideosHtml(specials);
imageLoader.lazyChildren(specialsContent);
function renderArtistTrackList(page, item, user) {
const request = {
SortBy: 'Name',
SortOrder: 'Ascending',
IncludeItemTypes: 'Audio',
Recursive: true,
ArtistIds: item.Id
};

ServerConnections.getApiClient(item.ServerId).getItems(user.Id, request).then(function (result) {
if (result.Items.length) {
page.querySelector('#specialsCollapsible').classList.remove('hide');
page.querySelector('#specialsCollapsible').classList.add('verticalSection-extrabottompadding');
page.querySelector('#specialsCollapsible>.sectionTitle').innerHTML = 'Songs';
const specialsContent = page.querySelector('#specialsContent');
specialsContent.classList.remove('itemsContainer');
specialsContent.innerHTML = listView.getListViewHtml({
items: result.Items,
smallIcon: true,
showIndexNumberLeft: false,
playFromHere: true,
action: 'play',
album: true
});
imageLoader.lazyChildren(specialsContent);
} else {
page.querySelector('#specialsCollapsible').classList.add('hide');
}
});
}

function renderSpecials(page, item, user) {
if ( item.Type == 'MusicArtist' ) {
theevilapplepie marked this conversation as resolved.
Show resolved Hide resolved
renderArtistTrackList(page, item, user);
} else {
ServerConnections.getApiClient(item.ServerId).getSpecialFeatures(user.Id, item.Id).then(function (specials) {
const specialsContent = page.querySelector('#specialsContent');
specialsContent.innerHTML = getVideosHtml(specials);
imageLoader.lazyChildren(specialsContent);
});
}
}

function renderCast(page, item, people) {
if (!people.length) {
page.querySelector('#castCollapsible').classList.add('hide');
Expand Down
Loading