diff options
Diffstat (limited to 'src/data/things/track.js')
-rw-r--r-- | src/data/things/track.js | 98 |
1 files changed, 60 insertions, 38 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js index a0d2f641..ff4750db 100644 --- a/src/data/things/track.js +++ b/src/data/things/track.js @@ -3,7 +3,6 @@ import {inspect} from 'node:util'; import CacheableObject from '#cacheable-object'; import {colors} from '#cli'; import {input} from '#composite'; -import find from '#find'; import Thing from '#thing'; import {isBoolean, isColor, isContributionList, isDate, isFileExtension} from '#validators'; @@ -21,7 +20,6 @@ import { import {withPropertyFromObject} from '#composite/data'; import { - exitWithoutDependency, exposeConstant, exposeDependency, exposeDependencyOrContinue, @@ -50,10 +48,11 @@ import { referenceList, referencedArtworkList, reverseReferenceList, - reverseReferencedArtworkList, simpleDate, simpleString, singleReference, + soupyFind, + soupyReverse, thing, urls, wikiData, @@ -63,7 +62,6 @@ import { exitWithoutUniqueCoverArt, inheritContributionListFromOriginalRelease, inheritFromOriginalRelease, - trackReverseReferenceList, withAlbum, withAlwaysReferenceByDirectory, withContainingTrackSection, @@ -83,7 +81,6 @@ export class Track extends Thing { static [Thing.getPropertyDescriptors] = ({ Album, ArtTag, - Artist, Flash, TrackSection, WikiInfo, @@ -221,8 +218,7 @@ export class Track extends Thing { originalReleaseTrack: singleReference({ class: input.value(Track), - find: input.value(find.track), - data: 'trackData', + find: soupyFind.input('track'), }), // Internal use only - for directly identifying an album inside a track's @@ -230,8 +226,7 @@ export class Track extends Thing { // included in an album's track list). dataSourceAlbum: singleReference({ class: input.value(Album), - find: input.value(find.album), - data: 'albumData', + find: soupyFind.input('album'), }), artistContribs: [ @@ -331,8 +326,7 @@ export class Track extends Thing { referenceList({ class: input.value(Track), - find: input.value(find.track), - data: 'trackData', + find: soupyFind.input('track'), }), ], @@ -343,8 +337,7 @@ export class Track extends Thing { referenceList({ class: input.value(Track), - find: input.value(find.track), - data: 'trackData', + find: soupyFind.input('track'), }), ], @@ -355,8 +348,7 @@ export class Track extends Thing { referenceList({ class: input.value(ArtTag), - find: input.value(find.artTag), - data: 'artTagData', + find: soupyFind.input('artTag'), }), ], @@ -376,30 +368,20 @@ export class Track extends Thing { // Update only + find: soupyFind(), + reverse: soupyReverse(), + + // used for referencedArtworkList (mixedFind) albumData: wikiData({ class: input.value(Album), }), - artistData: wikiData({ - class: input.value(Artist), - }), - - artTagData: wikiData({ - class: input.value(ArtTag), - }), - - flashData: wikiData({ - class: input.value(Flash), - }), - + // used for referencedArtworkList (mixedFind) trackData: wikiData({ class: input.value(Track), }), - trackSectionData: wikiData({ - class: input.value(TrackSection), - }), - + // used for withMatchingContributionPresets (indirectly by Contribution) wikiInfo: thing({ class: input.value(WikiInfo), }), @@ -445,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: [ @@ -463,7 +444,9 @@ export class Track extends Thing { value: input.value([]), }), - reverseReferencedArtworkList(), + reverseReferenceList({ + reverse: soupyReverse.input('artworksWhichReference'), + }), ], }); @@ -656,6 +639,45 @@ export class Track extends Thing { }, }; + static [Thing.reverseSpecs] = { + tracksWhichReference: { + bindTo: 'trackData', + + referencing: track => track.isOriginalRelease ? [track] : [], + referenced: track => track.referencedTracks, + }, + + tracksWhichSample: { + bindTo: 'trackData', + + 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. static [Thing.getYamlLoadingSpec] = null; |