« get me outta code hell

data: Referenced Artworks - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/checks.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-11-14 20:11:42 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-11-15 20:40:14 -0400
commit18849547f4bed29da0b0ad8b69a74b4c2e83ef43 (patch)
treeb66e4bd95b2f19aa08b080bfd29c498aa7702ab2 /src/data/checks.js
parent4f6e0bc351831abedca9dcb9667987b2907e0a61 (diff)
data: Referenced Artworks
Diffstat (limited to 'src/data/checks.js')
-rw-r--r--src/data/checks.js26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/data/checks.js b/src/data/checks.js
index cbc4ce0b..feefc171 100644
--- a/src/data/checks.js
+++ b/src/data/checks.js
@@ -9,7 +9,7 @@ import {compareArrays, cut, cutStart, empty, getNestedProp, iterateMultiline}
   from '#sugar';
 import Thing from '#thing';
 import thingConstructors from '#things';
-import {commentaryRegexCaseSensitive} from '#wiki-data';
+import {combineWikiDataArrays, commentaryRegexCaseSensitive} from '#wiki-data';
 
 import {
   annotateErrorWithIndex,
@@ -184,8 +184,7 @@ export function filterReferenceErrors(wikiData, {
       bannerArtistContribs: '_contrib',
       groups: 'group',
       artTags: '_artTag',
-      referencedTrackArtworks: '_trackArtwork',
-      referencedAlbumArtworks: '_albumArtwork',
+      referencedArtworks: '_artwork',
       commentary: '_commentary',
     }],
 
@@ -222,8 +221,7 @@ export function filterReferenceErrors(wikiData, {
       referencedTracks: '_trackNotRerelease',
       sampledTracks: '_trackNotRerelease',
       artTags: '_artTag',
-      referencedTrackArtworks: '_trackArtwork',
-      referencedAlbumArtworks: '_albumArtwork',
+      referencedArtworks: '_artwork',
       originalReleaseTrack: '_trackNotRerelease',
       commentary: '_commentary',
     }],
@@ -290,9 +288,23 @@ export function filterReferenceErrors(wikiData, {
             let findFn;
 
             switch (findFnKey) {
-              case '_albumArtwork':
-                findFn = ref => boundFind.album(ref.reference);
+              case '_artwork': {
+                const mixed =
+                  find.mixed({
+                    album: find.album,
+                    track: find.track,
+                  });
+
+                const data =
+                  combineWikiDataArrays([
+                    wikiData.albumData,
+                    wikiData.trackData,
+                  ]);
+
+                findFn = ref => mixed(ref.reference, data);
+
                 break;
+              }
 
               case '_artTag':
                 findFn = boundFind.artTag;