« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateAlbumCoverArtwork.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generateAlbumCoverArtwork.js')
-rw-r--r--src/content/dependencies/generateAlbumCoverArtwork.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/content/dependencies/generateAlbumCoverArtwork.js b/src/content/dependencies/generateAlbumCoverArtwork.js
new file mode 100644
index 00000000..f7e86303
--- /dev/null
+++ b/src/content/dependencies/generateAlbumCoverArtwork.js
@@ -0,0 +1,23 @@
+export default {
+  contentDependencies: ['generateCoverArtwork'],
+
+  relations(relation, album) {
+    return {
+      coverArtwork:
+        relation('generateCoverArtwork', album.artTags),
+    };
+  },
+
+  data(album) {
+    return {
+      path: ['media.albumCover', album.directory, album.coverArtFileExtension],
+    };
+  },
+
+  generate(data, relations) {
+    return relations.coverArtwork
+      .slots({
+        path: data.path,
+      });
+  },
+};