« get me outta code hell

thumbs: getExpectedImagePaths: cleanup + wallpaper parts - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/gen-thumbs.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-01-06 19:44:38 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-01-06 19:44:38 -0400
commitf25e61a530ea11925bb54cbd234003f2ff99b276 (patch)
tree8e42bd0f4637e7a9ab2c458d1ed1323fb79cc2ed /src/gen-thumbs.js
parent1b78a825e2c3f6a535497a64840fe88be23c44f1 (diff)
thumbs: getExpectedImagePaths: cleanup + wallpaper parts preview
Diffstat (limited to 'src/gen-thumbs.js')
-rw-r--r--src/gen-thumbs.js25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/gen-thumbs.js b/src/gen-thumbs.js
index d08726c7..6c82761f 100644
--- a/src/gen-thumbs.js
+++ b/src/gen-thumbs.js
@@ -1264,11 +1264,28 @@ export function getExpectedImagePaths(mediaPath, {urls, wikiData}) {
 
   const paths = [
     wikiData.albumData
-      .flatMap(album => [
-        album.hasCoverArt && fromRoot.to('media.albumCover', album.directory, album.coverArtFileExtension),
-        !empty(CacheableObject.getUpdateValue(album, 'bannerArtistContribs')) && fromRoot.to('media.albumBanner', album.directory, album.bannerFileExtension),
-        !empty(CacheableObject.getUpdateValue(album, 'wallpaperArtistContribs')) && fromRoot.to('media.albumWallpaper', album.directory, album.wallpaperFileExtension),
+      .map(album => [
+        album.hasCoverArt && [
+          fromRoot.to('media.albumCover', album.directory, album.coverArtFileExtension),
+        ],
+
+        !empty(CacheableObject.getUpdateValue(album, 'bannerArtistContribs')) && [
+          fromRoot.to('media.albumBanner', album.directory, album.bannerFileExtension),
+        ],
+
+        !empty(CacheableObject.getUpdateValue(album, 'wallpaperArtistContribs')) &&
+        empty(album.wallpaperParts) && [
+          fromRoot.to('media.albumWallpaper', album.directory, album.wallpaperFileExtension),
+        ],
+
+        !empty(CacheableObject.getUpdateValue(album, 'wallpaperArtistContribs')) &&
+        !empty(album.wallpaperParts) &&
+          album.wallpaperParts.flatMap(part => [
+            part.asset &&
+              fromRoot.to('media.albumWallpaperPart', album.directory, part.asset),
+          ]),
       ])
+      .flat(2)
       .filter(Boolean),
 
     wikiData.artistData