« get me outta code hell

data, checks: find.{album,track}WithArtwork - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-11-19 15:56:14 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-11-19 15:56:14 -0400
commitd746ff26c3e7517c8aaff7615ae4da06fa2d01c0 (patch)
tree8bd06ac5502acf24ab4ba23a0ce959c73e51b186 /src
parentd81e8d50645d476d41c800ba5ae12497ec5932a3 (diff)
data, checks: find.{album,track}WithArtwork
Diffstat (limited to 'src')
-rw-r--r--src/data/checks.js4
-rw-r--r--src/data/composite/wiki-properties/referencedArtworkList.js4
-rw-r--r--src/data/things/album.js8
-rw-r--r--src/data/things/track.js13
4 files changed, 25 insertions, 4 deletions
diff --git a/src/data/checks.js b/src/data/checks.js
index a9e8208f..8f9f0305 100644
--- a/src/data/checks.js
+++ b/src/data/checks.js
@@ -291,8 +291,8 @@ export function filterReferenceErrors(wikiData, {
               case '_artwork': {
                 const mixed =
                   find.mixed({
-                    album: find.album,
-                    track: find.track,
+                    album: find.albumWithArtwork,
+                    track: find.trackWithArtwork,
                   });
 
                 const data =
diff --git a/src/data/composite/wiki-properties/referencedArtworkList.js b/src/data/composite/wiki-properties/referencedArtworkList.js
index 74790443..a242af2c 100644
--- a/src/data/composite/wiki-properties/referencedArtworkList.js
+++ b/src/data/composite/wiki-properties/referencedArtworkList.js
@@ -32,8 +32,8 @@ export default templateCompositeFrom({
       compute: (continuation) => continuation({
         ['#find']:
           find.mixed({
-            track: find.track,
-            album: find.album,
+            track: find.trackWithArtwork,
+            album: find.albumWithArtwork,
           }),
       }),
     },
diff --git a/src/data/things/album.js b/src/data/things/album.js
index 35cf1f3e..3f3f195a 100644
--- a/src/data/things/album.js
+++ b/src/data/things/album.js
@@ -337,6 +337,14 @@ export class Album extends Thing {
       referenceTypes: ['album', 'album-commentary', 'album-gallery'],
       bindTo: 'albumData',
     },
+
+    albumWithArtwork: {
+      referenceTypes: ['album'],
+      bindTo: 'albumData',
+
+      include: album =>
+        album.hasCoverArt,
+    },
   };
 
   static [Thing.yamlDocumentSpec] = {
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 0ac6aabd..408f18fb 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -628,6 +628,19 @@ export class Track extends Thing {
           ? []
           : [track.name]),
     },
+
+    trackWithArtwork: {
+      referenceTypes: ['track'],
+      bindTo: 'trackData',
+
+      include: track =>
+        track.hasUniqueCoverArt,
+
+      getMatchableNames: track =>
+        (track.alwaysReferenceByDirectory
+          ? []
+          : [track.name]),
+    },
   };
 
   // Track YAML loading is handled in album.js.