diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-03-04 10:22:38 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-03-04 10:22:38 -0400 |
commit | dca169fbf6c6bf09f3ad4e5bf3b153b7bd83f1f9 (patch) | |
tree | f4571d7ae2169a3d05ce9e62160282782be4ee77 | |
parent | e1ab9bbf56113257c9d0818912c95f62c458f1e3 (diff) |
content: gAIPTracksChunkedList: avoid obscuring as-artist credit
-rw-r--r-- | src/content/dependencies/generateArtistInfoPageTracksChunkedList.js | 72 |
1 files changed, 64 insertions, 8 deletions
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 |