« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generateAlbumCoverArtwork.js6
-rw-r--r--src/content/dependencies/generateTrackCoverArtwork.js30
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' &&