diff options
Diffstat (limited to 'src/data')
-rw-r--r-- | src/data/things/track.js | 61 | ||||
-rw-r--r-- | src/data/yaml.js | 2 |
2 files changed, 51 insertions, 12 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js index b41dbb5b..28caf1de 100644 --- a/src/data/things/track.js +++ b/src/data/things/track.js @@ -61,17 +61,51 @@ export class Track extends Thing { dateFirstReleased: simpleDate(), color: [ - exposeUpdateValueOrContinue(), + exposeUpdateValueOrContinue({ + validate: input.value(isColor), + }), withContainingTrackSection(), withPropertyFromObject({object: '#trackSection', property: 'color'}), exposeDependencyOrContinue({dependency: '#trackSection.color'}), withPropertyFromAlbum({property: 'color'}), - exposeDependency({ - dependency: '#album.color', - update: {validate: isColor}, + exposeDependency({dependency: '#album.color'}), + ], + + // Controls how find.track works - it'll never be matched by a reference + // just to the track's name, which means you don't have to always reference + // some *other* (much more commonly referenced) track by directory instead + // of more naturally by name. + alwaysReferenceByDirectory: [ + exposeUpdateValueOrContinue({ + validate: input.value(isBoolean), }), + + excludeFromList({ + list: 'trackData', + item: input.myself(), + }), + + withOriginalRelease({ + data: '#trackData', + }), + + exitWithoutDependency({ + dependency: '#originalRelease', + value: input.value(false), + }), + + withPropertyFromObject({ + object: '#originalRelease', + property: input.value('name'), + }), + + { + dependencies: ['name', '#originalRelease.name'], + compute({name, '#originalRelease.name': originalName}) => + name === originalName, + }, ], // Disables presenting the track as though it has its own unique artwork. @@ -506,6 +540,9 @@ export const withOriginalRelease = templateCompositeFrom({ inputs: { selfIfOriginal: input({type: 'boolean', defaultValue: false}), + + // todo: validate + data: input({defaultDependency: 'trackData'}), }, outputs: { @@ -513,14 +550,14 @@ export const withOriginalRelease = templateCompositeFrom({ }, steps: () => [ - withResolvedReference - .inputs({ - ref: 'originalReleaseTrack', - data: 'trackData', - find: input.value(find.track), - notFoundMode: input.value('exit'), - }) - .outputs({into: '#originalRelease'}), + withResolvedReference({ + ref: 'originalReleaseTrack', + data: input('data'), + find: input.value(find.track), + notFoundMode: input.value('exit'), + }).outputs({ + '#resolvedReference': '#originalRelease', + }), { dependencies: [ diff --git a/src/data/yaml.js b/src/data/yaml.js index e1e5803d..c799be5f 100644 --- a/src/data/yaml.js +++ b/src/data/yaml.js @@ -342,6 +342,8 @@ export const processTrackDocument = makeProcessDocument(T.Track, { coverArtFileExtension: 'Cover Art File Extension', disableUniqueCoverArt: 'Has Cover Art', // This gets transformed to flip true/false. + alwaysReferenceByDirectory: 'Always Reference By Directory', + lyrics: 'Lyrics', commentary: 'Commentary', additionalFiles: 'Additional Files', |