From 77fc589466fc0c04326231638c5ec6026e7948d4 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 11 Jan 2025 20:49:26 -0400 Subject: data: soupy reverse --- src/data/things/track.js | 54 +++++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 21 deletions(-) (limited to 'src/data/things/track.js') diff --git a/src/data/things/track.js b/src/data/things/track.js index 81ba35bb..ff4750db 100644 --- a/src/data/things/track.js +++ b/src/data/things/track.js @@ -48,11 +48,11 @@ import { referenceList, referencedArtworkList, reverseReferenceList, - reverseReferencedArtworkList, simpleDate, simpleString, singleReference, soupyFind, + soupyReverse, thing, urls, wikiData, @@ -62,7 +62,6 @@ import { exitWithoutUniqueCoverArt, inheritContributionListFromOriginalRelease, inheritFromOriginalRelease, - trackReverseReferenceList, withAlbum, withAlwaysReferenceByDirectory, withContainingTrackSection, @@ -370,29 +369,18 @@ export class Track extends Thing { // Update only find: soupyFind(), + reverse: soupyReverse(), // used for referencedArtworkList (mixedFind) - // used for withAlbum (reverse) albumData: wikiData({ class: input.value(Album), }), - // used for featuredInFlashes (reverse) - flashData: wikiData({ - class: input.value(Flash), - }), - // used for referencedArtworkList (mixedFind) - // used for trackReverseReferenceList (reverse) trackData: wikiData({ class: input.value(Track), }), - // used for withContainingTrackSection (reverse) - trackSectionData: wikiData({ - class: input.value(TrackSection), - }), - // used for withMatchingContributionPresets (indirectly by Contribution) wikiInfo: thing({ class: input.value(WikiInfo), @@ -439,17 +427,16 @@ export class Track extends Thing { exposeDependency({dependency: '#otherReleases'}), ], - referencedByTracks: trackReverseReferenceList({ - list: input.value('referencedTracks'), + referencedByTracks: reverseReferenceList({ + reverse: soupyReverse.input('tracksWhichReference'), }), - sampledByTracks: trackReverseReferenceList({ - list: input.value('sampledTracks'), + sampledByTracks: reverseReferenceList({ + reverse: soupyReverse.input('tracksWhichSample'), }), featuredInFlashes: reverseReferenceList({ - data: 'flashData', - list: input.value('featuredTracks'), + reverse: soupyReverse.input('flashesWhichFeature'), }), referencedByArtworks: [ @@ -457,7 +444,9 @@ export class Track extends Thing { value: input.value([]), }), - reverseReferencedArtworkList(), + reverseReferenceList({ + reverse: soupyReverse.input('artworksWhichReference'), + }), ], }); @@ -664,6 +653,29 @@ export class Track extends Thing { referencing: track => track.isOriginalRelease ? [track] : [], referenced: track => track.sampledTracks, }, + + tracksWhoseArtworksFeature: { + bindTo: 'trackData', + + referencing: track => [track], + referenced: track => track.artTags, + }, + + trackArtistContributionsBy: + soupyReverse.contributionsBy('trackData', 'artistContribs'), + + trackContributorContributionsBy: + soupyReverse.contributionsBy('trackData', 'contributorContribs'), + + trackCoverArtistContributionsBy: + soupyReverse.contributionsBy('trackData', 'coverArtistContribs'), + + tracksWithCommentaryBy: { + bindTo: 'trackData', + + referencing: track => [track], + referenced: track => track.commentatorArtists, + }, }; // Track YAML loading is handled in album.js. -- cgit 1.3.0-6-gf8a5