« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/track.js50
1 files changed, 24 insertions, 26 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 401543f3..31eed682 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -89,9 +89,7 @@ import {
   exitWithoutUniqueCoverArt,
   inheritContributionListFromMainRelease,
   inheritFromMainRelease,
-  withDirectorySuffix,
   withPropertyFromAlbum,
-  withSuffixDirectoryFromAlbum,
   withTrackNumber,
 } from '#composite/things/track';
 
@@ -136,34 +134,23 @@ export class Track extends Thing {
     name: name('Unnamed Track'),
     nameText: contentString(),
 
-    directory: [
-      withDirectorySuffix(),
-
-      directory({
-        suffix: '#directorySuffix',
-      }),
-    ],
+    directory: directory({
+      suffix: 'directorySuffix',
+    }),
 
     suffixDirectoryFromAlbum: [
-      {
-        dependencies: [
-          input.updateValue({validate: isBoolean}),
-        ],
-
-        compute: (continuation, {
-          [input.updateValue()]: value,
-        }) => continuation({
-          ['#flagValue']: value ?? false,
-        }),
-      },
+      exposeUpdateValueOrContinue({
+        validate: input.value(isBoolean),
+      }),
 
-      withSuffixDirectoryFromAlbum({
-        flagValue: '#flagValue',
+      withPropertyFromObject({
+        object: 'trackSection',
+        property: input.value('suffixTrackDirectories'),
       }),
 
       exposeDependency({
-        dependency: '#suffixDirectoryFromAlbum',
-      })
+        dependency: '#trackSection.suffixTrackDirectories',
+      }),
     ],
 
     alwaysReferenceByDirectory: alwaysReferenceByDirectory(),
@@ -632,8 +619,19 @@ export class Track extends Thing {
     commentatorArtists: commentatorArtists(),
 
     directorySuffix: [
-      withDirectorySuffix(),
-      exposeDependency({dependency: '#directorySuffix'}),
+      exitWithoutDependency({
+        dependency: 'suffixDirectoryFromAlbum',
+        mode: input.value('falsy'),
+      }),
+
+      withPropertyFromObject({
+        object: 'trackSection',
+        property: input.value('directorySuffix'),
+      }),
+
+      exposeDependency({
+        dependency: '#trackSection.directorySuffix',
+      }),
     ],
 
     date: [