« get me outta code hell

content: generate{Album,ArtTag,Artist}GalleryPage: rectangles - 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>2024-04-13 15:28:12 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-04-13 15:47:35 -0300
commitfb6e7816d1911e9e2b218939d2b5c7eef22ab552 (patch)
tree89431b6ec22a6f746b3a56d655491f89f872a4bb /src
parentd23bf7443177a85f4c8bf9521dc63da7ccfdd799 (diff)
content: generate{Album,ArtTag,Artist}GalleryPage: rectangles
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateAlbumGalleryPage.js16
-rw-r--r--src/content/dependencies/generateArtTagGalleryPage.js11
-rw-r--r--src/content/dependencies/generateArtistGalleryPage.js11
3 files changed, 33 insertions, 5 deletions
diff --git a/src/content/dependencies/generateAlbumGalleryPage.js b/src/content/dependencies/generateAlbumGalleryPage.js
index f61b1983..b4f9268c 100644
--- a/src/content/dependencies/generateAlbumGalleryPage.js
+++ b/src/content/dependencies/generateAlbumGalleryPage.js
@@ -145,6 +145,18 @@ export default {
             : null)),
     ];
 
+    data.dimensions = [
+      (album.hasCoverArt
+        ? album.coverArtDimensions
+        : null),
+
+      ...
+        album.tracks.map(track =>
+          (track.hasUniqueCoverArt
+            ? track.coverArtDimensions
+            : null)),
+    ];
+
     return data;
   },
 
@@ -175,10 +187,12 @@ export default {
                 stitchArrays({
                   image: relations.images,
                   path: data.paths,
+                  dimensions: data.dimensions,
                   name: data.names,
-                }).map(({image, path, name}) =>
+                }).map(({image, path, dimensions, name}) =>
                     image.slots({
                       path,
+                      dimensions,
                       missingSourceContent:
                         language.$('misc.albumGalleryGrid.noCoverArt', {name}),
                     })),
diff --git a/src/content/dependencies/generateArtTagGalleryPage.js b/src/content/dependencies/generateArtTagGalleryPage.js
index 962f1b7f..338d18fe 100644
--- a/src/content/dependencies/generateArtTagGalleryPage.js
+++ b/src/content/dependencies/generateArtTagGalleryPage.js
@@ -74,6 +74,9 @@ export default {
           ? ['media.trackCover', thing.album.directory, thing.directory, thing.coverArtFileExtension]
           : ['media.albumCover', thing.directory, thing.coverArtFileExtension]));
 
+    data.dimensions =
+      query.things.map(thing => thing.coverArtDimensions);
+
     data.coverArtists =
       query.things.map(thing =>
         thing.coverArtistContribs
@@ -111,8 +114,12 @@ export default {
                 stitchArrays({
                   image: relations.images,
                   path: data.paths,
-                }).map(({image, path}) =>
-                    image.slot('path', path)),
+                  dimensions: data.dimensions,
+                }).map(({image, path, dimensions}) =>
+                    image.slots({
+                      path,
+                      dimensions,
+                    })),
 
               info:
                 data.coverArtists.map(names =>
diff --git a/src/content/dependencies/generateArtistGalleryPage.js b/src/content/dependencies/generateArtistGalleryPage.js
index 13779159..36343c18 100644
--- a/src/content/dependencies/generateArtistGalleryPage.js
+++ b/src/content/dependencies/generateArtistGalleryPage.js
@@ -68,6 +68,9 @@ export default {
           ? ['media.trackCover', thing.album.directory, thing.directory, thing.coverArtFileExtension]
           : ['media.albumCover', thing.directory, thing.coverArtFileExtension]));
 
+    data.dimensions =
+      query.things.map(thing => thing.coverArtDimensions);
+
     data.otherCoverArtists =
       query.things.map(thing =>
         (thing.coverArtistContribs.length > 1
@@ -107,8 +110,12 @@ export default {
                 stitchArrays({
                   image: relations.images,
                   path: data.paths,
-                }).map(({image, path}) =>
-                    image.slot('path', path)),
+                  dimensions: data.dimensions,
+                }).map(({image, path, dimensions}) =>
+                    image.slots({
+                      path,
+                      dimensions,
+                    })),
 
               info:
                 data.otherCoverArtists.map(names =>