« 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/track.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/things/track.js')
-rw-r--r--src/data/things/track.js27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 078ad11b..2ee42fdf 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -88,7 +88,31 @@ export class Track extends Thing {
     // Update & expose
 
     name: name('Unnamed Track'),
-    directory: directory(),
+
+    directory: [
+      withPropertyFromAlbum({
+        property: input.value('directorySuffix'),
+      }),
+
+      {
+        dependencies: ['suffixDirectory', '#album.directorySuffix'],
+        compute: (continuation, {
+          ['suffixDirectory']: suffixDirectory,
+          ['#album.directorySuffix']: directorySuffix,
+        }) => continuation({
+          ['#suffix']:
+            (suffixDirectory
+              ? directorySuffix
+              : null),
+        }),
+      },
+
+      directory({
+        suffix: '#suffix',
+      }),
+    ],
+
+    suffixDirectory: flag(false),
 
     additionalNames: additionalNameList(),
 
@@ -434,6 +458,7 @@ export class Track extends Thing {
     fields: {
       'Track': {property: 'name'},
       'Directory': {property: 'directory'},
+      'Suffix Directory': {property: 'suffixDirectory'},
 
       'Additional Names': {
         property: 'additionalNames',