From 9dc7c08e2fa7a0303fda3b9a687b55425c594aef Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 26 May 2026 19:05:38 -0300 Subject: data, urls: vgm-album-art and suchness --- src/data/things/album/Album.js | 67 +++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 33 deletions(-) (limited to 'src/data/things/album/Album.js') 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... -- cgit 1.3.0-6-gf8a5