From 8d3f6d3895c2cafe902a781f11e7a9d989edbf07 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 9 Dec 2024 16:06:49 -0400 Subject: content: generate{Album,Track}CoverArtwork: content warnings(!!) oops :+1: --- .../dependencies/generateAlbumCoverArtwork.js | 6 +++++ .../dependencies/generateTrackCoverArtwork.js | 30 ++++++++++++++++------ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/content/dependencies/generateAlbumCoverArtwork.js b/src/content/dependencies/generateAlbumCoverArtwork.js index 1e11c0ac..ff7d2b85 100644 --- a/src/content/dependencies/generateAlbumCoverArtwork.js +++ b/src/content/dependencies/generateAlbumCoverArtwork.js @@ -45,6 +45,11 @@ export default { dimensions: album.coverArtDimensions, + + warnings: + album.artTags + .filter(tag => tag.isContentWarning) + .map(tag => tag.name), }), slots: { @@ -73,6 +78,7 @@ export default { }), dimensions: data.dimensions, + warnings: data.warnings, details: [ slots.details === 'tags' && diff --git a/src/content/dependencies/generateTrackCoverArtwork.js b/src/content/dependencies/generateTrackCoverArtwork.js index 90ce2b4a..9153e2fc 100644 --- a/src/content/dependencies/generateTrackCoverArtwork.js +++ b/src/content/dependencies/generateTrackCoverArtwork.js @@ -12,7 +12,19 @@ export default { extraDependencies: ['html', 'language'], - relations: (relation, track) => ({ + query: (track) => ({ + artTags: + (track.hasUniqueCoverArt + ? track.artTags + : track.album.artTags), + + coverArtistContribs: + (track.hasUniqueCoverArt + ? track.coverArtistContribs + : track.album.coverArtistContribs), + }), + + relations: (relation, query, track) => ({ coverArtwork: relation('generateCoverArtwork'), @@ -21,15 +33,11 @@ export default { artTagDetails: relation('generateCoverArtworkArtTagDetails', - (track.hasUniqueCoverArt - ? track.artTags - : track.album.artTags)), + query.artTags), artistDetails: relation('generateCoverArtworkArtistDetails', - (track.hasUniqueCoverArt - ? track.coverArtistContribs - : track.album.coverArtistContribs)), + query.coverArtistContribs), referenceDetails: relation('generateCoverArtworkReferenceDetails', @@ -46,7 +54,7 @@ export default { relation('linkAlbum', track.album), }), - data: (track) => ({ + data: (query, track) => ({ path: (track.hasUniqueCoverArt ? ['media.trackCover', track.album.directory, track.directory, track.coverArtFileExtension] @@ -62,6 +70,11 @@ export default { nonUnique: !track.hasUniqueCoverArt, + + warnings: + query.artTags + .filter(tag => tag.isContentWarning) + .map(tag => tag.name), }), slots: { @@ -95,6 +108,7 @@ export default { }), dimensions: data.dimensions, + warnings: data.warnings, details: [ slots.details === 'tags' && -- cgit 1.3.0-6-gf8a5