« get me outta code hell

data, urls: vgm-album-art and suchness - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/album/Album.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-05-26 19:05:38 -0300
committer(quasar) nebula <qznebula@protonmail.com>2026-05-26 19:05:38 -0300
commit9dc7c08e2fa7a0303fda3b9a687b55425c594aef (patch)
tree7b7ed5843e48abd0a2d1058cfaa1294d0d0da87d /src/data/things/album/Album.js
parent3b4fb2fbd12348ee0f98dc18c8f456a72c7876f6 (diff)
data, urls: vgm-album-art and suchness preview
Diffstat (limited to 'src/data/things/album/Album.js')
-rw-r--r--src/data/things/album/Album.js67
1 files changed, 34 insertions, 33 deletions
diff --git a/src/data/things/album/Album.js b/src/data/things/album/Album.js
index 44eb1181..7efc2d8c 100644
--- a/src/data/things/album/Album.js
+++ b/src/data/things/album/Album.js
@@ -922,53 +922,54 @@ export class Album extends Thing {
   }
 
   getOwnArtworkPath(artwork) {
+    const ext = artwork.fileExtension;
+
     if (artwork === this.bannerArtwork) {
-      return [
-        'media.albumBanner',
-        this.directory,
-        artwork.fileExtension,
-      ];
+      return this.getAlbumArtPath(`banner.${ext}`);
     }
 
     if (artwork === this.wallpaperArtwork) {
-      if (!empty(this.wallpaperParts)) {
+      if (empty(this.wallpaperParts)) {
+        return this.getAlbumArtPath(`bg.${ext}`);
+      } else {
         return null;
       }
-
-      return [
-        'media.albumWallpaper',
-        this.directory,
-        artwork.fileExtension,
-      ];
     }
 
-    // TODO: using trackCover here is obviously, badly wrong
-    // but we ought to refactor banners and wallpapers similarly
-    // (i.e. depend on those intrinsic artwork paths rather than
-    // accessing media.{albumBanner,albumWallpaper} from content
-    // or other code directly)
-    return [
-      'media.trackCover',
-      this.directory,
-
+    const basename =
       (artwork.unqualifiedDirectory
         ? 'cover-' + artwork.unqualifiedDirectory
-        : 'cover'),
+        : 'cover');
 
-      artwork.fileExtension,
-    ];
+    return this.getAlbumArtPath(`${basename}.${ext}`);
+  }
+
+  getWallpaperPartPath(part) {
+    return this.getAlbumArtPath(part.asset);
   }
 
   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,
-    ];
+    const filename =
+      musicVideo.unqualifiedDirectory +
+      `.${musicVideo.coverArtFileExtension}`;
+
+    return this.getAlbumArtPath(filename);
+  }
+
+  getAlbumArtPath(filename) {
+    const key = this.#getArtworkPathKey();
+    const front = [key, this.directory];
+    return [...front, filename];
+  }
+
+  #getArtworkPathKey(artwork) {
+    switch (this.style) {
+      case 'in-game vgm':
+        return 'media.vgmAlbumArt';
+
+      default:
+        return 'media.albumArt';
+    }
   }
 
   // As of writing, albums don't even have a `duration` property...