« get me outta code hell

content, data: MusicVideo.date - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateMusicVideo.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-01-17 04:46:11 -0400
committer(quasar) nebula <qznebula@protonmail.com>2026-01-17 04:46:11 -0400
commitda43a2365d18216a6fc54f073b7ec85cc4e7dafc (patch)
treeb2ade98b7899a861442484f3db3e24ee030b3878 /src/content/dependencies/generateMusicVideo.js
parente2c11819c26e97f6715b4327f564e8601fd04cb3 (diff)
content, data: MusicVideo.date
Diffstat (limited to 'src/content/dependencies/generateMusicVideo.js')
-rw-r--r--src/content/dependencies/generateMusicVideo.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/content/dependencies/generateMusicVideo.js b/src/content/dependencies/generateMusicVideo.js
index a61cd5b7..7f0108af 100644
--- a/src/content/dependencies/generateMusicVideo.js
+++ b/src/content/dependencies/generateMusicVideo.js
@@ -1,5 +1,5 @@
 export default {
-  relations: (relation, musicVideo) => ({
+  relations: (relation, musicVideo, thing) => ({
     image:
       relation('image', {
         path: musicVideo.path,
@@ -7,6 +7,9 @@ export default {
         dimensions: musicVideo.coverArtDimensions,
       }),
 
+    datetimestamp:
+      relation('generateAbsoluteDatetimestamp', musicVideo.date, thing.date),
+
     artistCredit:
       relation('generateArtistCredit', musicVideo.artistContribs, []),
 
@@ -14,7 +17,7 @@ export default {
       relation('generateArtistCredit', musicVideo.contributorContribs, []),
   }),
 
-  data: (musicVideo) => ({
+  data: (musicVideo, _track) => ({
     label:
       musicVideo.label,
 
@@ -46,16 +49,25 @@ export default {
 
           [
             language.encapsulate(capsule, 'by', workingCapsule => {
-              const additionalStringOptions = {};
+              const workingOptions = {};
 
               if (data.label) {
                 workingCapsule += '.customLabel';
-                additionalStringOptions.label = data.label;
+                workingOptions.label = data.label;
+              }
+
+              const {datetimestamp} = relations;
+
+              datetimestamp.setSlot('style', 'year-difference');
+
+              if (!html.isBlank(datetimestamp)) {
+                workingCapsule += '.withDate';
+                workingOptions.date = datetimestamp;
               }
 
               return relations.artistCredit.slots({
                 normalStringKey: workingCapsule,
-                additionalStringOptions,
+                additionalStringOptions: workingOptions,
 
                 showAnnotation: true,
                 showChronology: true,