From dca169fbf6c6bf09f3ad4e5bf3b153b7bd83f1f9 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 4 Mar 2024 10:22:38 -0400 Subject: content: gAIPTracksChunkedList: avoid obscuring as-artist credit --- .../generateArtistInfoPageTracksChunkedList.js | 72 +++++++++++++++++++--- 1 file changed, 64 insertions(+), 8 deletions(-) (limited to 'src/content/dependencies') diff --git a/src/content/dependencies/generateArtistInfoPageTracksChunkedList.js b/src/content/dependencies/generateArtistInfoPageTracksChunkedList.js index d68eba3f..f003779d 100644 --- a/src/content/dependencies/generateArtistInfoPageTracksChunkedList.js +++ b/src/content/dependencies/generateArtistInfoPageTracksChunkedList.js @@ -47,17 +47,23 @@ export default { const tracksAsArtistAndContributorContribs = tracksAsArtistAndContributor .map(track => [ - ...track.artistContribs, - ...track.contributorContribs, + ... + track.artistContribs + .map(contrib => ({...contrib, kind: 'artist'})), + ... + track.contributorContribs + .map(contrib => ({...contrib, kind: 'contributor'})), ]); const tracksAsArtistOnlyContribs = tracksAsArtistOnly - .map(track => track.artistContribs); + .map(track => track.artistContribs + .map(contrib => ({...contrib, kind: 'artist'}))); const tracksAsContributorOnlyContribs = tracksAsContributorOnly - .map(track => track.contributorContribs); + .map(track => track.contributorContribs + .map(contrib => ({...contrib, kind: 'contributor'}))); const tracksAsArtistAndContributorEntries = processTrackEntries({ @@ -144,10 +150,60 @@ export default { query.chunks.map(({chunk}) => chunk .map(({contribs}) => - contribs - .filter(({who}) => who === artist) - .filter(({what}) => what) - .map(({what}) => what)) + contribs.filter(({who}) => who === artist)) + .map(ownContribs => ({ + creditedAsArtist: + ownContribs + .some(({kind}) => kind === 'artist'), + + creditedAsContributor: + ownContribs + .some(({kind}) => kind === 'contributor'), + + annotatedContribs: + ownContribs + .filter(({what}) => what), + })) + .map(({annotatedContribs, ...rest}) => ({ + ...rest, + + annotatedArtistContribs: + annotatedContribs + .filter(({kind}) => kind === 'artist'), + + annotatedContributorContribs: + annotatedContribs + .filter(({kind}) => kind === 'contributor'), + })) + .map(({ + creditedAsArtist, + creditedAsContributor, + annotatedArtistContribs, + annotatedContributorContribs, + }) => { + // Don't display annotations associated with crediting in the + // Contributors field if the artist is also credited as an Artist + // *and* the Artist-field contribution is non-annotated. This is + // so that we don't misrepresent the artist - the contributor + // annotation tends to be for "secondary" and performance roles. + // For example, this avoids crediting Marcy Nabors on Renewed + // Return seemingly only for "bass clarinet" when they're also + // the one who composed and arranged Renewed Return! + if ( + creditedAsArtist && + creditedAsContributor && + empty(annotatedArtistContribs) + ) { + return []; + } + + return [ + ...annotatedArtistContribs, + ...annotatedContributorContribs, + ]; + }) + .map(contribs => + contribs.map(({what}) => what)) .map(contributions => (empty(contributions) ? null -- cgit 1.3.0-6-gf8a5