From 7ef4941fa8cc00b0ea128f51fd859f264800fe05 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 31 Jan 2026 23:02:08 -0400 Subject: data, content: Album.musicVideos --- .../dependencies/generateAlbumArtworkColumn.js | 5 +++++ .../dependencies/generateMusicVideoDateLine.js | 3 ++- src/data/things/album/Album.js | 25 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) (limited to 'src') 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) { -- cgit 1.3.0-6-gf8a5