« get me outta code hell

content: generateCoverArtwork - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateAlbumInfoPageContent.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-04-05 21:40:46 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-04-05 21:40:46 -0300
commitf61b789661300238460001a91697269a00de7271 (patch)
tree4068f6fc3402c8ae8aabd19d5b7b99a60b5e9327 /src/content/dependencies/generateAlbumInfoPageContent.js
parent7fb97e45fb926aed5b6aceeb53abb139368a36ac (diff)
content: generateCoverArtwork
Diffstat (limited to 'src/content/dependencies/generateAlbumInfoPageContent.js')
-rw-r--r--src/content/dependencies/generateAlbumInfoPageContent.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/content/dependencies/generateAlbumInfoPageContent.js b/src/content/dependencies/generateAlbumInfoPageContent.js
index 41c9d309..e959f274 100644
--- a/src/content/dependencies/generateAlbumInfoPageContent.js
+++ b/src/content/dependencies/generateAlbumInfoPageContent.js
@@ -7,6 +7,7 @@ export default {
     'generateAlbumTrackList',
     'generateContributionLinks',
     'generateContentHeading',
+    'generateCoverArtwork',
     'linkAlbumCommentary',
     'linkAlbumGallery',
     'linkExternal',
@@ -21,6 +22,9 @@ export default {
   relations(relation, album) {
     const relations = {};
 
+    relations.cover =
+      relation('generateCoverArtwork', album.artTags);
+
     const contributionLinksRelation = contribs =>
       relation('generateContributionLinks', contribs, {
         showContribution: true,
@@ -80,6 +84,9 @@ export default {
   data(album) {
     const data = {};
 
+    data.coverArtDirectory = album.directory;
+    data.coverArtFileExtension = album.coverArtFileExtension;
+
     data.date = album.date;
     data.duration = accumulateSum(album.tracks, track => track.duration);
     data.durationApproximate = album.tracks.length > 1;
@@ -109,6 +116,10 @@ export default {
   }) {
     const content = {};
 
+    content.cover = relations.cover
+      .slot('path', ['media.albumCover', data.coverArtDirectory, data.coverArtFileExtension])
+      .slot('alt', language.$('misc.alt.trackCover'));
+
     content.main = {
       headingMode: 'sticky',
       content: html.tag(null, [