From 76e508ffe3818a78fb941ecde05fe9c269e8bc22 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 19 Feb 2025 16:24:14 -0400 Subject: data: isOriginalRelease -> isMainRelease, etc Also isRerelease -> isSecondaryRelease Im sure this is completely bug free and will not involve squashing one million additional commits --- src/data/checks.js | 35 +++++---- .../composite/things/artist/artistTotalDuration.js | 8 +- src/data/composite/things/track/index.js | 8 +- .../inheritContributionListFromMainRelease.js | 44 +++++++++++ .../inheritContributionListFromOriginalRelease.js | 44 ----------- .../things/track/inheritFromMainRelease.js | 41 +++++++++++ .../things/track/inheritFromOriginalRelease.js | 41 ----------- .../things/track/withAlwaysReferenceByDirectory.js | 27 +++---- src/data/composite/things/track/withMainRelease.js | 70 ++++++++++++++++++ .../composite/things/track/withOriginalRelease.js | 70 ------------------ .../composite/things/track/withOtherReleases.js | 19 ++--- .../things/track/withPropertyFromMainRelease.js | 86 ++++++++++++++++++++++ .../track/withPropertyFromOriginalRelease.js | 86 ---------------------- src/data/things/track.js | 67 ++++++++--------- 14 files changed, 322 insertions(+), 324 deletions(-) create mode 100644 src/data/composite/things/track/inheritContributionListFromMainRelease.js delete mode 100644 src/data/composite/things/track/inheritContributionListFromOriginalRelease.js create mode 100644 src/data/composite/things/track/inheritFromMainRelease.js delete mode 100644 src/data/composite/things/track/inheritFromOriginalRelease.js create mode 100644 src/data/composite/things/track/withMainRelease.js delete mode 100644 src/data/composite/things/track/withOriginalRelease.js create mode 100644 src/data/composite/things/track/withPropertyFromMainRelease.js delete mode 100644 src/data/composite/things/track/withPropertyFromOriginalRelease.js (limited to 'src/data') diff --git a/src/data/checks.js b/src/data/checks.js index ff278d36..10261e4f 100644 --- a/src/data/checks.js +++ b/src/data/checks.js @@ -228,11 +228,11 @@ export function filterReferenceErrors(wikiData, { artistContribs: '_contrib', contributorContribs: '_contrib', coverArtistContribs: '_contrib', - referencedTracks: '_trackNotRerelease', - sampledTracks: '_trackNotRerelease', + referencedTracks: '_trackMainReleasesOnly', + sampledTracks: '_trackMainReleasesOnly', artTags: '_artTag', referencedArtworks: '_artwork', - originalReleaseTrack: '_trackNotRerelease', + mainReleaseTrack: '_trackMainReleasesOnly', commentary: '_commentary', }], @@ -358,29 +358,28 @@ export function filterReferenceErrors(wikiData, { findFn = ref => boundFind.track(ref.reference); break; - case '_trackNotRerelease': + case '_trackMainReleasesOnly': findFn = trackRef => { const track = boundFind.track(trackRef); - const originalRef = track && CacheableObject.getUpdateValue(track, 'originalReleaseTrack'); + const mainRef = track && CacheableObject.getUpdateValue(track, 'mainReleaseTrack'); - if (originalRef) { - // It's possible for the original to not actually exist, in this case. - // It should still be reported since the 'Originally Released As' field - // was present. - const original = boundFind.track(originalRef, {mode: 'quiet'}); + if (mainRef) { + // It's possible for the main release to not actually exist, in this case. + // It should still be reported since the 'Main Release' field was present. + const main = boundFind.track(mainRef, {mode: 'quiet'}); // Prefer references by name, but only if it's unambiguous. - const originalByName = - (original - ? boundFind.track(original.name, {mode: 'quiet'}) + const mainByName = + (main + ? boundFind.track(main.name, {mode: 'quiet'}) : null); const shouldBeMessage = - (originalByName - ? colors.green(original.name) - : original - ? colors.green('track:' + original.directory) - : colors.green(originalRef)); + (mainByName + ? colors.green(main.name) + : main + ? colors.green('track:' + main.directory) + : colors.green(mainRef)); throw new Error(`Reference ${colors.red(trackRef)} is to a rerelease, should be ${shouldBeMessage}`); } diff --git a/src/data/composite/things/artist/artistTotalDuration.js b/src/data/composite/things/artist/artistTotalDuration.js index a4a33542..b8a205fe 100644 --- a/src/data/composite/things/artist/artistTotalDuration.js +++ b/src/data/composite/things/artist/artistTotalDuration.js @@ -48,18 +48,18 @@ export default templateCompositeFrom({ withPropertyFromList({ list: '#allContributions.thing', - property: input.value('isOriginalRelease'), + property: input.value('isMainRelease'), }), withFilteredList({ list: '#allContributions', - filter: '#allContributions.thing.isOriginalRelease', + filter: '#allContributions.thing.isMainRelease', }).outputs({ - '#filteredList': '#originalContributions', + '#filteredList': '#mainReleaseContributions', }), withContributionListSums({ - list: '#originalContributions', + list: '#mainReleaseContributions', }), exposeDependency({ diff --git a/src/data/composite/things/track/index.js b/src/data/composite/things/track/index.js index 32c72f78..492b35be 100644 --- a/src/data/composite/things/track/index.js +++ b/src/data/composite/things/track/index.js @@ -1,15 +1,15 @@ export {default as exitWithoutUniqueCoverArt} from './exitWithoutUniqueCoverArt.js'; -export {default as inheritContributionListFromOriginalRelease} from './inheritContributionListFromOriginalRelease.js'; -export {default as inheritFromOriginalRelease} from './inheritFromOriginalRelease.js'; +export {default as inheritContributionListFromMainRelease} from './inheritContributionListFromMainRelease.js'; +export {default as inheritFromMainRelease} from './inheritFromMainRelease.js'; export {default as withAlbum} from './withAlbum.js'; export {default as withAlwaysReferenceByDirectory} from './withAlwaysReferenceByDirectory.js'; export {default as withContainingTrackSection} from './withContainingTrackSection.js'; export {default as withDate} from './withDate.js'; export {default as withDirectorySuffix} from './withDirectorySuffix.js'; export {default as withHasUniqueCoverArt} from './withHasUniqueCoverArt.js'; -export {default as withOriginalRelease} from './withOriginalRelease.js'; +export {default as withMainRelease} from './withMainRelease.js'; export {default as withOtherReleases} from './withOtherReleases.js'; export {default as withPropertyFromAlbum} from './withPropertyFromAlbum.js'; -export {default as withPropertyFromOriginalRelease} from './withPropertyFromOriginalRelease.js'; +export {default as withPropertyFromMainRelease} from './withPropertyFromMainRelease.js'; export {default as withSuffixDirectoryFromAlbum} from './withSuffixDirectoryFromAlbum.js'; export {default as withTrackArtDate} from './withTrackArtDate.js'; diff --git a/src/data/composite/things/track/inheritContributionListFromMainRelease.js b/src/data/composite/things/track/inheritContributionListFromMainRelease.js new file mode 100644 index 00000000..89252feb --- /dev/null +++ b/src/data/composite/things/track/inheritContributionListFromMainRelease.js @@ -0,0 +1,44 @@ +// Like inheritFromMainRelease, but tuned for contributions. +// Recontextualizes contributions for this track. + +import {input, templateCompositeFrom} from '#composite'; + +import {exposeDependency, raiseOutputWithoutDependency} + from '#composite/control-flow'; +import {withRecontextualizedContributionList, withRedatedContributionList} + from '#composite/wiki-data'; + +import withDate from './withDate.js'; +import withPropertyFromMainRelease + from './withPropertyFromMainRelease.js'; + +export default templateCompositeFrom({ + annotation: `inheritContributionListFromMainRelease`, + + steps: () => [ + withPropertyFromMainRelease({ + property: input.thisProperty(), + notFoundValue: input.value([]), + }), + + raiseOutputWithoutDependency({ + dependency: '#isSecondaryRelease', + mode: input.value('falsy'), + }), + + withRecontextualizedContributionList({ + list: '#mainReleaseValue', + }), + + withDate(), + + withRedatedContributionList({ + list: '#mainReleaseValue', + date: '#date', + }), + + exposeDependency({ + dependency: '#mainReleaseValue', + }), + ], +}); diff --git a/src/data/composite/things/track/inheritContributionListFromOriginalRelease.js b/src/data/composite/things/track/inheritContributionListFromOriginalRelease.js deleted file mode 100644 index f4ae3ddb..00000000 --- a/src/data/composite/things/track/inheritContributionListFromOriginalRelease.js +++ /dev/null @@ -1,44 +0,0 @@ -// Like inheritFromOriginalRelease, but tuned for contributions. -// Recontextualized contributions for this track. - -import {input, templateCompositeFrom} from '#composite'; - -import {exposeDependency, raiseOutputWithoutDependency} - from '#composite/control-flow'; -import {withRecontextualizedContributionList, withRedatedContributionList} - from '#composite/wiki-data'; - -import withDate from './withDate.js'; -import withPropertyFromOriginalRelease - from './withPropertyFromOriginalRelease.js'; - -export default templateCompositeFrom({ - annotation: `inheritContributionListFromOriginalRelease`, - - steps: () => [ - withPropertyFromOriginalRelease({ - property: input.thisProperty(), - notFoundValue: input.value([]), - }), - - raiseOutputWithoutDependency({ - dependency: '#isRerelease', - mode: input.value('falsy'), - }), - - withRecontextualizedContributionList({ - list: '#originalValue', - }), - - withDate(), - - withRedatedContributionList({ - list: '#originalValue', - date: '#date', - }), - - exposeDependency({ - dependency: '#originalValue', - }), - ], -}); diff --git a/src/data/composite/things/track/inheritFromMainRelease.js b/src/data/composite/things/track/inheritFromMainRelease.js new file mode 100644 index 00000000..b1cbb65e --- /dev/null +++ b/src/data/composite/things/track/inheritFromMainRelease.js @@ -0,0 +1,41 @@ +// Early exits with the value for the same property as specified on the +// main release, if this track is a secondary release, and otherwise continues +// without providing any further dependencies. +// +// Like withMainRelease, this will early exit (with notFoundValue) if the +// main release is specified by reference and that reference doesn't +// resolve to anything. + +import {input, templateCompositeFrom} from '#composite'; + +import {exposeDependency, raiseOutputWithoutDependency} + from '#composite/control-flow'; + +import withPropertyFromMainRelease + from './withPropertyFromMainRelease.js'; + +export default templateCompositeFrom({ + annotation: `inheritFromMainRelease`, + + inputs: { + notFoundValue: input({ + defaultValue: null, + }), + }, + + steps: () => [ + withPropertyFromMainRelease({ + property: input.thisProperty(), + notFoundValue: input('notFoundValue'), + }), + + raiseOutputWithoutDependency({ + dependency: '#isSecondaryRelease', + mode: input.value('falsy'), + }), + + exposeDependency({ + dependency: '#mainReleaseValue', + }), + ], +}); diff --git a/src/data/composite/things/track/inheritFromOriginalRelease.js b/src/data/composite/things/track/inheritFromOriginalRelease.js deleted file mode 100644 index 38ab06be..00000000 --- a/src/data/composite/things/track/inheritFromOriginalRelease.js +++ /dev/null @@ -1,41 +0,0 @@ -// Early exits with the value for the same property as specified on the -// original release, if this track is a rerelease, and otherwise continues -// without providing any further dependencies. -// -// Like withOriginalRelease, this will early exit (with notFoundValue) if the -// original release is specified by reference and that reference doesn't -// resolve to anything. - -import {input, templateCompositeFrom} from '#composite'; - -import {exposeDependency, raiseOutputWithoutDependency} - from '#composite/control-flow'; - -import withPropertyFromOriginalRelease - from './withPropertyFromOriginalRelease.js'; - -export default templateCompositeFrom({ - annotation: `inheritFromOriginalRelease`, - - inputs: { - notFoundValue: input({ - defaultValue: null, - }), - }, - - steps: () => [ - withPropertyFromOriginalRelease({ - property: input.thisProperty(), - notFoundValue: input('notFoundValue'), - }), - - raiseOutputWithoutDependency({ - dependency: '#isRerelease', - mode: input.value('falsy'), - }), - - exposeDependency({ - dependency: '#originalValue', - }), - ], -}); diff --git a/src/data/composite/things/track/withAlwaysReferenceByDirectory.js b/src/data/composite/things/track/withAlwaysReferenceByDirectory.js index 26c5ba97..aebcf793 100644 --- a/src/data/composite/things/track/withAlwaysReferenceByDirectory.js +++ b/src/data/composite/things/track/withAlwaysReferenceByDirectory.js @@ -51,7 +51,7 @@ export default templateCompositeFrom({ // Remaining code is for defaulting to true if this track is a rerelease of // another with the same name, so everything further depends on access to - // trackData as well as originalReleaseTrack. + // trackData as well as mainReleaseTrack. exitWithoutDependency({ dependency: 'trackData', @@ -60,45 +60,46 @@ export default templateCompositeFrom({ }), exitWithoutDependency({ - dependency: 'originalReleaseTrack', + dependency: 'mainReleaseTrack', value: input.value(false), }), - // It's necessary to use the custom trackOriginalReleasesOnly find function + // It's necessary to use the custom trackMainReleasesOnly find function // here, so as to avoid recursion issues - the find.track() function depends // on accessing each track's alwaysReferenceByDirectory, which means it'll // hit *this track* - and thus this step - and end up recursing infinitely. - // By definition, find.trackOriginalReleasesOnly excludes tracks which have - // an originalReleaseTrack update value set, which means even though it does + // By definition, find.trackMainReleasesOnly excludes tracks which have + // an mainReleaseTrack update value set, which means even though it does // still access each of tracks' `alwaysReferenceByDirectory` property, it // won't access that of *this* track - it will never proceed past the // `exitWithoutDependency` step directly above, so there's no opportunity // for recursion. withResolvedReference({ - ref: 'originalReleaseTrack', + ref: 'mainReleaseTrack', data: 'trackData', - find: input.value(find.trackOriginalReleasesOnly), + find: input.value(find.trackMainReleasesOnly), }).outputs({ - '#resolvedReference': '#originalRelease', + '#resolvedReference': '#mainRelease', }), exitWithoutDependency({ - dependency: '#originalRelease', + dependency: '#mainRelease', value: input.value(false), }), withPropertyFromObject({ - object: '#originalRelease', + object: '#mainRelease', property: input.value('name'), }), { - dependencies: ['name', '#originalRelease.name'], + dependencies: ['name', '#mainRelease.name'], compute: (continuation, { name, - ['#originalRelease.name']: originalName, + ['#mainRelease.name']: mainReleaseName, }) => continuation({ - ['#alwaysReferenceByDirectory']: name === originalName, + ['#alwaysReferenceByDirectory']: + name === mainReleaseName, }), }, ], diff --git a/src/data/composite/things/track/withMainRelease.js b/src/data/composite/things/track/withMainRelease.js new file mode 100644 index 00000000..3a91edae --- /dev/null +++ b/src/data/composite/things/track/withMainRelease.js @@ -0,0 +1,70 @@ +// Just includes the main release of this track as a dependency. +// If this track isn't a secondary release, then it'll provide null, unless +// the {selfIfMain} option is set, in which case it'll provide this track +// itself. This will early exit (with notFoundValue) if the main release +// is specified by reference and that reference doesn't resolve to anything. + +import {input, templateCompositeFrom} from '#composite'; + +import {exitWithoutDependency, withResultOfAvailabilityCheck} + from '#composite/control-flow'; +import {withResolvedReference} from '#composite/wiki-data'; +import {soupyFind} from '#composite/wiki-properties'; + +export default templateCompositeFrom({ + annotation: `withMainRelease`, + + inputs: { + selfIfMain: input({type: 'boolean', defaultValue: false}), + notFoundValue: input({defaultValue: null}), + }, + + outputs: ['#mainRelease'], + + steps: () => [ + withResultOfAvailabilityCheck({ + from: 'mainReleaseTrack', + }), + + { + dependencies: [ + input.myself(), + input('selfIfMain'), + '#availability', + ], + + compute: (continuation, { + [input.myself()]: track, + [input('selfIfMain')]: selfIfMain, + '#availability': availability, + }) => + (availability + ? continuation() + : continuation.raiseOutput({ + ['#mainRelease']: + (selfIfMain ? track : null), + })), + }, + + withResolvedReference({ + ref: 'mainReleaseTrack', + find: soupyFind.input('track'), + }), + + exitWithoutDependency({ + dependency: '#resolvedReference', + value: input('notFoundValue'), + }), + + { + dependencies: ['#resolvedReference'], + + compute: (continuation, { + ['#resolvedReference']: resolvedReference, + }) => + continuation({ + ['#mainRelease']: resolvedReference, + }), + }, + ], +}); diff --git a/src/data/composite/things/track/withOriginalRelease.js b/src/data/composite/things/track/withOriginalRelease.js deleted file mode 100644 index 7aefc64a..00000000 --- a/src/data/composite/things/track/withOriginalRelease.js +++ /dev/null @@ -1,70 +0,0 @@ -// Just includes the original release of this track as a dependency. -// If this track isn't a rerelease, then it'll provide null, unless the -// {selfIfOriginal} option is set, in which case it'll provide this track -// itself. This will early exit (with notFoundValue) if the original release -// is specified by reference and that reference doesn't resolve to anything. - -import {input, templateCompositeFrom} from '#composite'; - -import {exitWithoutDependency, withResultOfAvailabilityCheck} - from '#composite/control-flow'; -import {withResolvedReference} from '#composite/wiki-data'; -import {soupyFind} from '#composite/wiki-properties'; - -export default templateCompositeFrom({ - annotation: `withOriginalRelease`, - - inputs: { - selfIfOriginal: input({type: 'boolean', defaultValue: false}), - notFoundValue: input({defaultValue: null}), - }, - - outputs: ['#originalRelease'], - - steps: () => [ - withResultOfAvailabilityCheck({ - from: 'originalReleaseTrack', - }), - - { - dependencies: [ - input.myself(), - input('selfIfOriginal'), - '#availability', - ], - - compute: (continuation, { - [input.myself()]: track, - [input('selfIfOriginal')]: selfIfOriginal, - '#availability': availability, - }) => - (availability - ? continuation() - : continuation.raiseOutput({ - ['#originalRelease']: - (selfIfOriginal ? track : null), - })), - }, - - withResolvedReference({ - ref: 'originalReleaseTrack', - find: soupyFind.input('track'), - }), - - exitWithoutDependency({ - dependency: '#resolvedReference', - value: input('notFoundValue'), - }), - - { - dependencies: ['#resolvedReference'], - - compute: (continuation, { - ['#resolvedReference']: resolvedReference, - }) => - continuation({ - ['#originalRelease']: resolvedReference, - }), - }, - ], -}); diff --git a/src/data/composite/things/track/withOtherReleases.js b/src/data/composite/things/track/withOtherReleases.js index f8c1c3f0..3fec8742 100644 --- a/src/data/composite/things/track/withOtherReleases.js +++ b/src/data/composite/things/track/withOtherReleases.js @@ -2,7 +2,7 @@ import {input, templateCompositeFrom} from '#composite'; import {exitWithoutDependency} from '#composite/control-flow'; -import withOriginalRelease from './withOriginalRelease.js'; +import withMainRelease from './withMainRelease.js'; export default templateCompositeFrom({ annotation: `withOtherReleases`, @@ -15,26 +15,27 @@ export default templateCompositeFrom({ mode: input.value('empty'), }), - withOriginalRelease({ - selfIfOriginal: input.value(true), + withMainRelease({ + selfIfMain: input.value(true), notFoundValue: input.value([]), }), + // TODO: Jegus shouldn't this be a proper reverse list { - dependencies: [input.myself(), '#originalRelease', 'trackData'], + dependencies: [input.myself(), '#mainRelease', 'trackData'], compute: (continuation, { [input.myself()]: thisTrack, - ['#originalRelease']: originalRelease, + ['#mainRelease']: mainRelease, trackData, }) => continuation({ ['#otherReleases']: - (originalRelease === thisTrack + (mainRelease === thisTrack ? [] - : [originalRelease]) + : [mainRelease]) .concat(trackData.filter(track => - track !== originalRelease && + track !== mainRelease && track !== thisTrack && - track.originalReleaseTrack === originalRelease)), + track.mainReleaseTrack === mainRelease)), }), }, ], diff --git a/src/data/composite/things/track/withPropertyFromMainRelease.js b/src/data/composite/things/track/withPropertyFromMainRelease.js new file mode 100644 index 00000000..393a4c63 --- /dev/null +++ b/src/data/composite/things/track/withPropertyFromMainRelease.js @@ -0,0 +1,86 @@ +// Provides a value inherited from the main release, if applicable, and a +// flag indicating if this track is a secondary release or not. +// +// Like withMainRelease, this will early exit (with notFoundValue) if the +// main release is specified by reference and that reference doesn't +// resolve to anything. + +import {input, templateCompositeFrom} from '#composite'; + +import {withResultOfAvailabilityCheck} from '#composite/control-flow'; +import {withPropertyFromObject} from '#composite/data'; + +import withMainRelease from './withMainRelease.js'; + +export default templateCompositeFrom({ + annotation: `inheritFromMainRelease`, + + inputs: { + property: input({type: 'string'}), + + notFoundValue: input({ + defaultValue: null, + }), + }, + + outputs: ({ + [input.staticValue('property')]: property, + }) => + ['#isSecondaryRelease'].concat( + (property + ? ['#mainRelease.' + property] + : ['#mainReleaseValue'])), + + steps: () => [ + withMainRelease({ + notFoundValue: input('notFoundValue'), + }), + + withResultOfAvailabilityCheck({ + from: '#mainRelease', + }), + + { + dependencies: [ + '#availability', + input.staticValue('property'), + ], + + compute: (continuation, { + ['#availability']: availability, + [input.staticValue('property')]: property, + }) => + (availability + ? continuation() + : continuation.raiseOutput( + Object.assign( + {'#isSecondaryRelease': false}, + (property + ? {['#mainRelease.' + property]: null} + : {'#mainReleaseValue': null})))), + }, + + withPropertyFromObject({ + object: '#mainRelease', + property: input('property'), + }), + + { + dependencies: [ + '#value', + input.staticValue('property'), + ], + + compute: (continuation, { + ['#value']: value, + [input.staticValue('property')]: property, + }) => + continuation.raiseOutput( + Object.assign( + {'#isSecondaryRelease': true}, + (property + ? {['#mainRelease.' + property]: value} + : {'#mainReleaseValue': value}))), + }, + ], +}); diff --git a/src/data/composite/things/track/withPropertyFromOriginalRelease.js b/src/data/composite/things/track/withPropertyFromOriginalRelease.js deleted file mode 100644 index fd37f6de..00000000 --- a/src/data/composite/things/track/withPropertyFromOriginalRelease.js +++ /dev/null @@ -1,86 +0,0 @@ -// Provides a value inherited from the original release, if applicable, and a -// flag indicating if this track is a rerelase or not. -// -// Like withOriginalRelease, this will early exit (with notFoundValue) if the -// original release is specified by reference and that reference doesn't -// resolve to anything. - -import {input, templateCompositeFrom} from '#composite'; - -import {withResultOfAvailabilityCheck} from '#composite/control-flow'; -import {withPropertyFromObject} from '#composite/data'; - -import withOriginalRelease from './withOriginalRelease.js'; - -export default templateCompositeFrom({ - annotation: `inheritFromOriginalRelease`, - - inputs: { - property: input({type: 'string'}), - - notFoundValue: input({ - defaultValue: null, - }), - }, - - outputs: ({ - [input.staticValue('property')]: property, - }) => - ['#isRerelease'].concat( - (property - ? ['#original.' + property] - : ['#originalValue'])), - - steps: () => [ - withOriginalRelease({ - notFoundValue: input('notFoundValue'), - }), - - withResultOfAvailabilityCheck({ - from: '#originalRelease', - }), - - { - dependencies: [ - '#availability', - input.staticValue('property'), - ], - - compute: (continuation, { - ['#availability']: availability, - [input.staticValue('property')]: property, - }) => - (availability - ? continuation() - : continuation.raiseOutput( - Object.assign( - {'#isRerelease': false}, - (property - ? {['#original.' + property]: null} - : {'#originalValue': null})))), - }, - - withPropertyFromObject({ - object: '#originalRelease', - property: input('property'), - }), - - { - dependencies: [ - '#value', - input.staticValue('property'), - ], - - compute: (continuation, { - ['#value']: value, - [input.staticValue('property')]: property, - }) => - continuation.raiseOutput( - Object.assign( - {'#isRerelease': true}, - (property - ? {['#original.' + property]: value} - : {'#originalValue': value}))), - }, - ], -}); diff --git a/src/data/things/track.js b/src/data/things/track.js index af2206f0..6ac417b5 100644 --- a/src/data/things/track.js +++ b/src/data/things/track.js @@ -60,15 +60,15 @@ import { import { exitWithoutUniqueCoverArt, - inheritContributionListFromOriginalRelease, - inheritFromOriginalRelease, + inheritContributionListFromMainRelease, + inheritFromMainRelease, withAlbum, withAlwaysReferenceByDirectory, withContainingTrackSection, withDate, withDirectorySuffix, withHasUniqueCoverArt, - withOriginalRelease, + withMainRelease, withOtherReleases, withPropertyFromAlbum, withSuffixDirectoryFromAlbum, @@ -208,7 +208,7 @@ export class Track extends Thing { creditSources: commentary(), lyrics: [ - inheritFromOriginalRelease(), + inheritFromMainRelease(), contentString(), ], @@ -216,7 +216,7 @@ export class Track extends Thing { sheetMusicFiles: additionalFiles(), midiProjectFiles: additionalFiles(), - originalReleaseTrack: singleReference({ + mainReleaseTrack: singleReference({ class: input.value(Track), find: soupyFind.input('track'), }), @@ -230,7 +230,7 @@ export class Track extends Thing { }), artistContribs: [ - inheritContributionListFromOriginalRelease(), + inheritContributionListFromMainRelease(), withDate(), @@ -266,7 +266,7 @@ export class Track extends Thing { ], contributorContribs: [ - inheritContributionListFromOriginalRelease(), + inheritContributionListFromMainRelease(), withDate(), @@ -276,9 +276,6 @@ export class Track extends Thing { }), ], - // Cover artists aren't inherited from the original release, since it - // typically varies by release and isn't defined by the musical qualities - // of the track. coverArtistContribs: [ exitWithoutUniqueCoverArt({ value: input.value([]), @@ -320,7 +317,7 @@ export class Track extends Thing { ], referencedTracks: [ - inheritFromOriginalRelease({ + inheritFromMainRelease({ notFoundValue: input.value([]), }), @@ -331,7 +328,7 @@ export class Track extends Thing { ], sampledTracks: [ - inheritFromOriginalRelease({ + inheritFromMainRelease({ notFoundValue: input.value([]), }), @@ -405,20 +402,20 @@ export class Track extends Thing { exposeDependency({dependency: '#hasUniqueCoverArt'}), ], - isOriginalRelease: [ - withOriginalRelease(), + isMainRelease: [ + withMainRelease(), exposeWhetherDependencyAvailable({ - dependency: '#originalRelease', + dependency: '#mainRelease', negate: input.value(true), }), ], - isRerelease: [ - withOriginalRelease(), + isSecondaryRelease: [ + withMainRelease(), exposeWhetherDependencyAvailable({ - dependency: '#originalRelease', + dependency: '#mainRelease', }), ], @@ -525,7 +522,7 @@ export class Track extends Thing { transform: parseAdditionalFiles, }, - 'Originally Released As': {property: 'originalReleaseTrack'}, + 'Main Release': {property: 'mainReleaseTrack'}, 'Referenced Tracks': {property: 'referencedTracks'}, 'Sampled Tracks': {property: 'sampledTracks'}, @@ -558,28 +555,28 @@ export class Track extends Thing { }, invalidFieldCombinations: [ - {message: `Rereleases inherit references from the original`, fields: [ - 'Originally Released As', + {message: `Secondary releases inherit references from the main one`, fields: [ + 'Main Release', 'Referenced Tracks', ]}, - {message: `Rereleases inherit samples from the original`, fields: [ - 'Originally Released As', + {message: `Secondary releases inherit samples from the main one`, fields: [ + 'Main Release', 'Sampled Tracks', ]}, - {message: `Rereleases inherit artists from the original`, fields: [ - 'Originally Released As', + {message: `Secondary releases inherit artists from the main one`, fields: [ + 'Main Release', 'Artists', ]}, - {message: `Rereleases inherit contributors from the original`, fields: [ - 'Originally Released As', + {message: `Secondary releases inherit contributors from the main one`, fields: [ + 'Main Release', 'Contributors', ]}, - {message: `Rereleases inherit lyrics from the original`, fields: [ - 'Originally Released As', + {message: `Secondary releases inherit lyrics from the main one`, fields: [ + 'Main Release', 'Lyrics', ]}, @@ -609,12 +606,12 @@ export class Track extends Thing { : [track.name]), }, - trackOriginalReleasesOnly: { + trackMainReleasesOnly: { referenceTypes: ['track'], bindTo: 'trackData', include: track => - !CacheableObject.getUpdateValue(track, 'originalReleaseTrack'), + !CacheableObject.getUpdateValue(track, 'mainReleaseTrack'), // It's still necessary to check alwaysReferenceByDirectory here, since // it may be set manually (with `Always Reference By Directory: true`), @@ -649,14 +646,14 @@ export class Track extends Thing { tracksWhichReference: { bindTo: 'trackData', - referencing: track => track.isOriginalRelease ? [track] : [], + referencing: track => track.isMainRelease ? [track] : [], referenced: track => track.referencedTracks, }, tracksWhichSample: { bindTo: 'trackData', - referencing: track => track.isOriginalRelease ? [track] : [], + referencing: track => track.isMainRelease ? [track] : [], referenced: track => track.sampledTracks, }, @@ -692,8 +689,8 @@ export class Track extends Thing { parts.push(Thing.prototype[inspect.custom].apply(this)); - if (CacheableObject.getUpdateValue(this, 'originalReleaseTrack')) { - parts.unshift(`${colors.yellow('[rerelease]')} `); + if (CacheableObject.getUpdateValue(this, 'mainReleaseTrack')) { + parts.unshift(`${colors.yellow('[secrelease]')} `); } let album; -- cgit 1.3.0-6-gf8a5