« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/data/composite/things/track/sharedAdditionalNameList.js24
-rw-r--r--src/data/validators.js4
-rw-r--r--src/data/yaml.js7
3 files changed, 32 insertions, 3 deletions
diff --git a/src/data/composite/things/track/sharedAdditionalNameList.js b/src/data/composite/things/track/sharedAdditionalNameList.js
index 1806ec80..28c04101 100644
--- a/src/data/composite/things/track/sharedAdditionalNameList.js
+++ b/src/data/composite/things/track/sharedAdditionalNameList.js
@@ -4,7 +4,12 @@ import {input, templateCompositeFrom} from '#composite';
 
 import {exitWithoutDependency, exposeDependency}
   from '#composite/control-flow';
-import {withFlattenedList, withPropertyFromList} from '#composite/data';
+
+import {
+  withFilteredList,
+  withFlattenedList,
+  withPropertyFromList,
+} from '#composite/data';
 
 import withOtherReleases from './withOtherReleases.js';
 
@@ -29,10 +34,25 @@ export default templateCompositeFrom({
 
     withFlattenedList({
       list: '#otherReleases.additionalNames',
+    }).outputs({
+      ['#flattenedList']: '#otherReleaseEntries',
+    }),
+
+    withPropertyFromList({
+      list: '#otherReleaseEntries',
+      property: input.value('specificAlbumExclusive'),
+    }),
+
+    // Filter out entries that have been marked as exclusive to the containing
+    // album.
+    withFilteredList({
+      list: '#otherReleaseEntries',
+      filter: '#otherReleaseEntries.specificAlbumExclusive',
+      flip: input.value(true),
     }),
 
     exposeDependency({
-      dependency: '#flattenedList',
+      dependency: '#filteredList',
     }),
   ],
 });
diff --git a/src/data/validators.js b/src/data/validators.js
index b7dbb629..22dc160c 100644
--- a/src/data/validators.js
+++ b/src/data/validators.js
@@ -921,6 +921,10 @@ export const isAdditionalName = validateProperties({
   name: isContentString,
   annotation: optional(isContentString),
 
+  // TODO: This only applies for tracks, not additional names
+  // in general.
+  specificAlbumExclusive: optional(isBoolean),
+
   // TODO: This only allows indicating sourcing from a track.
   // That's okay for the current limited use of "from", but
   // could be expanded later.
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 65e7bcae..e473790a 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -448,7 +448,11 @@ export function parseAdditionalFiles(entries) {
 export function parseAdditionalNames(entries) {
   return parseArrayEntries(entries, item => {
     if (typeof item === 'object' && typeof item['Name'] === 'string')
-      return {name: item['Name'], annotation: item['Annotation'] ?? null};
+      return {
+        name: item['Name'],
+        annotation: item['Annotation'] ?? null,
+        specificAlbumExclusive: item['This Album Only'] ?? null,
+      };
 
     if (typeof item !== 'string') return item;
 
@@ -458,6 +462,7 @@ export function parseAdditionalNames(entries) {
     return {
       name: match.groups.main,
       annotation: match.groups.accent ?? null,
+      specificAlbumExclusive: null,
     };
   });
 }