« get me outta code hell

content: generateMusicVideoArtistsLine: proper dynamics - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-02-01 00:08:53 -0400
committer(quasar) nebula <qznebula@protonmail.com>2026-02-01 00:09:04 -0400
commit28232be4352a3b67e8c60df294c9686ad9160640 (patch)
tree92d9c262532552f0fc70f2e01a06bd06b62e9012 /src
parentf1bc25f38f8103885f22d461b930d3afef64bfe2 (diff)
content: generateMusicVideoArtistsLine: proper dynamics
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateMusicVideoArtistsLine.js46
-rw-r--r--src/strings-default.yaml3
2 files changed, 32 insertions, 17 deletions
diff --git a/src/content/dependencies/generateMusicVideoArtistsLine.js b/src/content/dependencies/generateMusicVideoArtistsLine.js
index f79fdc8c..54114387 100644
--- a/src/content/dependencies/generateMusicVideoArtistsLine.js
+++ b/src/content/dependencies/generateMusicVideoArtistsLine.js
@@ -6,34 +6,46 @@ export default {
 
   data: (musicVideo) => ({
     label:
-      (musicVideo.label !== 'Music video'
-        ? musicVideo.label
-        : null),
+      musicVideo.label,
   }),
 
   generate: (data, relations, {html, language}) =>
     language.encapsulate('misc.musicVideo.artistsLine', artistsLineCapsule =>
       language.encapsulate(artistsLineCapsule, workingCapsule => {
-        const workingOptions = {[language.onlyIfOptions]: ['credit']};
+        const credit = relations.artistCredit;
 
-        if (data.label) {
-          workingCapsule += '.customLabel';
-          workingOptions.label = data.label;
+        credit.setSlots({
+          normalStringKey:
+            language.encapsulate(artistsLineCapsule, 'credit'),
+
+          showAnnotation: true,
+          showChronology: true,
+
+          chronologyKind: 'musicVideo',
+        });
+
+        if (html.isBlank(credit)) {
+          return html.blank();
         }
 
-        workingOptions.credit =
-          html.tag('span', {class: 'by'},
-            {[html.onlyIfContent]: true},
+        if (data.label === 'Music video' || !data.label) {
+          credit.setSlots({
+            normalStringKey:
+              language.encapsulate(artistsLineCapsule, 'noLabel'),
+          });
 
-            relations.artistCredit.slots({
-              normalStringKey:
-                language.encapsulate(artistsLineCapsule, 'credit'),
+          return credit;
+        }
+
+        const workingOptions = {};
 
-              showAnnotation: true,
-              showChronology: true,
+        workingOptions.credit =
+          html.tag('span', {class: 'by'}, credit);
 
-              chronologyKind: 'musicVideo',
-            }));
+        if (data.label && data.label !== 'Music video') {
+          workingCapsule += '.customLabel';
+          workingOptions.label = data.label;
+        }
 
         return language.$(workingCapsule, workingOptions);
       })),
diff --git a/src/strings-default.yaml b/src/strings-default.yaml
index 5bf2223b..86ddeee6 100644
--- a/src/strings-default.yaml
+++ b/src/strings-default.yaml
@@ -1002,6 +1002,9 @@ misc:
     artistsLine.credit: >-
       by {ARTISTS}
 
+    artistsLine.noLabel:
+      By {ARTISTS}
+
     date: >-
       Released {DATE}