« get me outta code hell

data, content: Album.musicVideos - 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-01-31 23:02:08 -0400
committer(quasar) nebula <qznebula@protonmail.com>2026-01-31 23:03:14 -0400
commit7ef4941fa8cc00b0ea128f51fd859f264800fe05 (patch)
treec006e2e01448a205d532ee129a29c88323fe68dc /src
parent180d3e169b10db5f1837567eca9bf1b2d5542b96 (diff)
data, content: Album.musicVideos
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateAlbumArtworkColumn.js5
-rw-r--r--src/content/dependencies/generateMusicVideoDateLine.js3
-rw-r--r--src/data/things/album/Album.js25
3 files changed, 32 insertions, 1 deletions
diff --git a/src/content/dependencies/generateAlbumArtworkColumn.js b/src/content/dependencies/generateAlbumArtworkColumn.js
index 5346e56b..cc27e6b4 100644
--- a/src/content/dependencies/generateAlbumArtworkColumn.js
+++ b/src/content/dependencies/generateAlbumArtworkColumn.js
@@ -31,6 +31,10 @@ export default {
             .map(artwork => relation('generateCoverArtwork', artwork))
 
         : []),
+
+    musicVideos:
+      album.musicVideos.map(musicVideo =>
+        relation('generateMusicVideo', musicVideo, album)),
   }),
 
   generate(relations, {html}) {
@@ -46,6 +50,7 @@ export default {
       relations.firstCovers,
       relations.albumArtInfoBox,
       relations.restCovers,
+      relations.musicVideos,
     ]);
   },
 };
diff --git a/src/content/dependencies/generateMusicVideoDateLine.js b/src/content/dependencies/generateMusicVideoDateLine.js
index 0c30ead5..98992584 100644
--- a/src/content/dependencies/generateMusicVideoDateLine.js
+++ b/src/content/dependencies/generateMusicVideoDateLine.js
@@ -2,6 +2,7 @@ function sameDay(musicVideo, thing) {
   if (!musicVideo.dateIsSpecified) return null;
 
   const compare = (a, b) =>
+    a && b &&
     a.toDateString() === b.toDateString();
 
   const album = thing.isTrack ? thing.album : thing;
@@ -15,7 +16,7 @@ function sameDay(musicVideo, thing) {
     }
   }
 
-  if (compare(musicVideo.date, track.date)) {
+  if (compare(musicVideo.date, track?.date)) {
     return 'track';
   }
 
diff --git a/src/data/things/album/Album.js b/src/data/things/album/Album.js
index 48d52223..8dcc6854 100644
--- a/src/data/things/album/Album.js
+++ b/src/data/things/album/Album.js
@@ -14,6 +14,7 @@ import {
   parseCreditingSources,
   parseDate,
   parseDimensions,
+  parseMusicVideos,
   parseWallpaperParts,
 } from '#yaml';
 
@@ -76,6 +77,7 @@ export class Album extends Thing {
     CommentaryEntry,
     CreditingSourcesEntry,
     Group,
+    MusicVideo,
     TrackArtistContribution,
     TrackSection,
     WikiInfo,
@@ -350,6 +352,10 @@ export class Album extends Thing {
       find: soupyFind.input('group'),
     }),
 
+    // > Update & expose - Music videos
+
+    musicVideos: thingList(V(MusicVideo)),
+
     // > Update & expose - Content entries
 
     commentary: thingList(V(CommentaryEntry)),
@@ -744,6 +750,13 @@ export class Album extends Thing {
 
       'Groups': {property: 'groups'},
 
+      // Music videos
+
+      'Music Videos': {
+        property: 'musicVideos',
+        transform: parseMusicVideos,
+      },
+
       // Content entries
 
       'Commentary': {
@@ -843,6 +856,18 @@ export class Album extends Thing {
     ];
   }
 
+  getOwnMusicVideoCoverPath(musicVideo) {
+    // Lala, same shenanigan as above, this is media.trackCover
+    // where it shouldn't be.
+
+    return [
+      'media.trackCover',
+      this.directory,
+      musicVideo.unqualifiedDirectory,
+      musicVideo.coverArtFileExtension,
+    ];
+  }
+
   // As of writing, albums don't even have a `duration` property...
   // so this function will never be called... but the message stands...
   countOwnContributionInDurationTotals(_contrib) {