diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2025-12-10 17:32:11 -0400 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2025-12-10 17:32:11 -0400 |
| commit | 69ae43806f57daf9a29caf5ee3de14ec53bcaac1 (patch) | |
| tree | 5d4bbd1aafe9a2c0b91b4e13aef349f3762dbb4a /src/data/things | |
| parent | 6b440b13585fd90614df42752a56d895c805256f (diff) | |
data, content: TrackSection.hasTrackNumbers
closes #566 PRETTY SWEET !!! examples here: https://discord.com/channels/749042497610842152/779895315750715422/1448422818944647429
Diffstat (limited to 'src/data/things')
| -rw-r--r-- | src/data/things/album.js | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/src/data/things/album.js b/src/data/things/album.js index f9d7a3a3..31d94ef1 100644 --- a/src/data/things/album.js +++ b/src/data/things/album.js @@ -979,20 +979,24 @@ export class TrackSection extends Thing { exposeDependency({dependency: '#album.color'}), ], + hasTrackNumbers: [ + exposeUpdateValueOrContinue({ + validate: input.value(isBoolean), + }), + + withPropertyFromObject('album', V('hasTrackNumbers')), + exposeDependency('#album.hasTrackNumbers'), + ], + startCountingFrom: [ exposeUpdateValueOrContinue({ validate: input.value(isNumber), }), - exitWithoutDependency({ - dependency: 'album', - value: input.value(1), - }), + withPropertyFromObject('album', V('hasTrackNumbers')), + exitWithoutDependency('#album.hasTrackNumbers', V(1), V('falsy')), - withPropertyFromObject({ - object: 'album', - property: input.value('trackSections'), - }), + withPropertyFromObject('album', V('trackSections')), withNearbyItemFromList({ list: '#album.trackSections', @@ -1002,19 +1006,10 @@ export class TrackSection extends Thing { '#nearbyItem': '#previousTrackSection', }), - exitWithoutDependency({ - dependency: '#previousTrackSection', - value: input.value(1), - }), - - withPropertyFromObject({ - object: '#previousTrackSection', - property: input.value('continueCountingFrom'), - }), + exitWithoutDependency('#previousTrackSection', V(1)), - exposeDependency({ - dependency: '#previousTrackSection.continueCountingFrom', - }), + withPropertyFromObject('#previousTrackSection', V('continueCountingFrom')), + exposeDependency('#previousTrackSection.continueCountingFrom'), ], dateOriginallyReleased: simpleDate(), @@ -1071,9 +1066,18 @@ export class TrackSection extends Thing { ], continueCountingFrom: [ - withLengthOfList({ - list: 'tracks', - }), + withPropertyFromObject('album', V('hasTrackNumbers')), + exitWithoutDependency('#album.hasTrackNumbers', V(null), V('falsy')), + + { + dependencies: ['hasTrackNumbers', 'startCountingFrom'], + compute: (continuation, {hasTrackNumbers, startCountingFrom}) => + (hasTrackNumbers + ? continuation() + : continuation.exit(startCountingFrom)), + }, + + withLengthOfList('tracks'), { dependencies: ['startCountingFrom', '#tracks.length'], @@ -1104,6 +1108,7 @@ export class TrackSection extends Thing { 'Suffix Track Directories': {property: 'suffixTrackDirectories'}, 'Color': {property: 'color'}, + 'Has Track Numbers': {property: 'hasTrackNumbers'}, 'Start Counting From': {property: 'startCountingFrom'}, 'Date Originally Released': { |