diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-04-06 17:40:51 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-04-10 16:02:41 -0300 |
commit | a446ecc747e7919f6dee4bc3b073e7edb6156a91 (patch) | |
tree | ace69dd336957a07e3c55f275f303cac8d8c13cb /src/data/things/album.js | |
parent | 9696dbe1688dcf9641875ea7a4fab50c5776017b (diff) |
data: make referencedArtworkList work again
Using new find specs {track,album}PrimaryArtwork. It's still mixedFind, and it still does not support matching artworks besides the primary one.
Diffstat (limited to 'src/data/things/album.js')
-rw-r--r-- | src/data/things/album.js | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/src/data/things/album.js b/src/data/things/album.js index fc5c9d7e..9137ac31 100644 --- a/src/data/things/album.js +++ b/src/data/things/album.js @@ -67,6 +67,7 @@ export class Album extends Thing { static [Thing.getPropertyDescriptors] = ({ ArtTag, + Artwork, Group, Track, TrackSection, @@ -269,13 +270,8 @@ export class Album extends Thing { reverse: soupyReverse(), // used for referencedArtworkList (mixedFind) - albumData: wikiData({ - class: input.value(Album), - }), - - // used for referencedArtworkList (mixedFind) - trackData: wikiData({ - class: input.value(Track), + artworkData: wikiData({ + class: input.value(Artwork), }), // used for withMatchingContributionPresets (indirectly by Contribution) @@ -381,6 +377,31 @@ export class Album extends Thing { ? [] : [album.name]), }, + + albumPrimaryArtwork: { + [Thing.findThisThingOnly]: false, + + referenceTypes: [ + 'album', + 'album-referencing-artworks', + 'album-referenced-artworks', + ], + + bindTo: 'artworkData', + + include: (artwork, {Artwork, Album}) => + artwork instanceof Artwork && + artwork.thing instanceof Album && + artwork === artwork.thing.coverArtworks[0], + + getMatchableNames: ({thing: album}) => + (album.alwaysReferenceByDirectory + ? [] + : [album.name]), + + getMatchableDirectories: ({thing: album}) => + [album.directory], + }, }; static [Thing.reverseSpecs] = { |