diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-07-11 08:38:01 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-07-11 08:38:01 -0300 |
commit | 2b71dd8f7c6652b53de72f477044569dbcf1aca0 (patch) | |
tree | 93dab72f5930fe2dc7c6463b7e30bc867d4d0b03 | |
parent | 6d64c58216d073b729afe02f69e4a14152ff3963 (diff) |
content: generateArtistRollingWindowPage: slightly smarter artworks
-rw-r--r-- | src/content/dependencies/generateArtistRollingWindowPage.js | 58 |
1 files changed, 18 insertions, 40 deletions
diff --git a/src/content/dependencies/generateArtistRollingWindowPage.js b/src/content/dependencies/generateArtistRollingWindowPage.js index 30909201..8c52dac0 100644 --- a/src/content/dependencies/generateArtistRollingWindowPage.js +++ b/src/content/dependencies/generateArtistRollingWindowPage.js @@ -16,9 +16,7 @@ export default { 'generateArtistNavLinks', 'generateCoverGrid', 'generatePageLayout', - 'linkAlbum', - 'linkFlash', - 'linkTrack', + 'linkAnythingMan', ], extraDependencies: ['html', 'language', 'wikiData'], @@ -138,6 +136,18 @@ export default { query.firstKind = query.kinds.at(0); + query.thingArtworks = + stitchArrays({ + thing: query.things, + kinds: query.thingContributionKinds, + }).map(({thing, kinds}) => + (kinds.includes('artwork') + ? (thing.coverArtworks ?? thing.trackArtworks ?? []) + .find(artwork => artwork.artistContribs + .some(contrib => contrib.artist === artist)) + : (thing.coverArtworks ?? thing.trackArtworks) + ?.[0] ?? null)); + const allGroups = unique(query.thingGroups.flat()); @@ -185,26 +195,12 @@ export default { relation('generateCoverGrid'), sourceGridImages: - query.things.map(thing => - (thing.constructor[Thing.referenceType] === 'album' && thing.hasCoverArt - ? relation('image', thing.artTags) - : thing.constructor[Thing.referenceType] === 'track' - ? (thing.hasUniqueCoverArt - ? relation('image', thing.artTags) - : thing.album.hasCoverArt - ? relation('image', thing.album.artTags) - : relation('image')) - : relation('image'))), + query.thingArtworks + .map(artwork => relation('image', artwork)), sourceGridLinks: - query.things.map(thing => - (thing.constructor[Thing.referenceType] === 'album' - ? relation('linkAlbum', thing) - : thing.constructor[Thing.referenceType] === 'track' - ? relation('linkTrack', thing) - : thing.constructor[Thing.referenceType] === 'flash' - ? relation('linkFlash', thing) - : null)), + query.things + .map(thing => relation('linkAnythingMan', thing)), }), data: (query, sprawl, artist) => ({ @@ -250,20 +246,6 @@ export default { .map(groups => groups .map(group => group.name)), - sourceGridPaths: - query.things.map(thing => - (thing.constructor[Thing.referenceType] === 'album' && thing.hasCoverArt - ? ['media.albumCover', thing.directory, thing.coverArtFileExtension] - : thing.constructor[Thing.referenceType] === 'track' - ? (thing.hasUniqueCoverArt - ? ['media.trackCover', thing.album.directory, thing.directory, thing.coverArtFileExtension] - : thing.album.hasCoverArt - ? ['media.albumCover', thing.album.directory, thing.album.coverArtFileExtension] - : null) - : thing.constructor[Thing.referenceType] === 'flash' - ? ['media.flashCover', thing.directory, thing.coverArtFileExtension] - : null)), - sourceGridContributionKinds: query.thingContributionKinds, @@ -399,11 +381,7 @@ export default { data.sourceGridNames, images: - stitchArrays({ - image: relations.sourceGridImages, - path: data.sourceGridPaths, - }).map(({image, path}) => - image.slot('path', path)), + relations.sourceGridImages, info: stitchArrays({ |