diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-01-13 14:31:14 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-01-13 14:31:14 -0400 |
commit | e73b5f1739d2c9f54c66b25500dc80e9bef25f36 (patch) | |
tree | 52dceac1cbe3e2e71e9cb05344a8e3d00ea851f7 /src | |
parent | ba94f5c02f867630604f94eb64138fe260c320c1 (diff) |
yaml: warn for art tags specified on things without cover art
Diffstat (limited to 'src')
-rw-r--r-- | src/data/yaml.js | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js index 9ee1d612..2137f994 100644 --- a/src/data/yaml.js +++ b/src/data/yaml.js @@ -1708,7 +1708,7 @@ export function filterReferenceErrors(wikiData) { wallpaperArtistContribs: '_contrib', bannerArtistContribs: '_contrib', groups: 'group', - artTags: 'artTag', + artTags: '_artTag', commentary: '_commentary', }], @@ -1736,7 +1736,7 @@ export function filterReferenceErrors(wikiData) { coverArtistContribs: '_contrib', referencedTracks: '_trackNotRerelease', sampledTracks: '_trackNotRerelease', - artTags: 'artTag', + artTags: '_artTag', originalReleaseTrack: '_trackNotRerelease', commentary: '_commentary', }], @@ -1814,6 +1814,10 @@ export function filterReferenceErrors(wikiData) { }; switch (findFnKey) { + case '_artTag': + findFn = boundFind.artTag; + break; + case '_commentary': findFn = findArtistOrAlias; break; @@ -1903,6 +1907,37 @@ export function filterReferenceErrors(wikiData) { let newPropertyValue = value; determineNewPropertyValue: { + // TODO: The special-casing for artTag is obviously a bit janky. + // It would be nice if this could be moved to processDocument ala + // fieldCombinationErrors, but art tags are only an error if the + // thing doesn't have an artwork - which can't be determined from + // the track document on its own, thanks to inheriting contribs + // from the album. + if (findFnKey === '_artTag') { + let hasCoverArtwork = + !empty(CacheableObject.getUpdateValue(thing, 'coverArtistContribs')); + + if (processDocumentFn === processTrackDocument) { + if (thing.album) { + hasCoverArtwork ||= + !empty(CacheableObject.getUpdateValue(thing.album, 'trackCoverArtistContribs')); + } + + if (thing.disableUniqueCoverArt) { + hasCoverArtwork = false; + } + } + + if (!hasCoverArtwork) { + nest({message: errorMessage}, ({push}) => { + push(new TypeError(`No cover artwork, so this shouldn't have art tags specified`)); + }); + + newPropertyValue = []; + break determineNewPropertyValue; + } + } + if (findFnKey === '_commentary') { filter( value, {message: errorMessage}, |