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/Track.js | 23 +++++++-------- src/data/things/album/Album.js | 67 +++++++++++++++++++++--------------------- 2 files changed, 44 insertions(+), 46 deletions(-) (limited to 'src/data/things') diff --git a/src/data/things/Track.js b/src/data/things/Track.js index ae527be6..a615af4a 100644 --- a/src/data/things/Track.js +++ b/src/data/things/Track.js @@ -1464,16 +1464,13 @@ export class Track extends Thing { getOwnArtworkPath(artwork) { if (!this.album) return null; - return [ - 'media.trackCover', - this.album.directory, - + const ext = artwork.fileExtension; + const basename = (artwork.unqualifiedDirectory ? this.directory + '-' + artwork.unqualifiedDirectory - : this.directory), + : this.directory); - artwork.fileExtension, - ]; + return this.album.getAlbumArtPath(`${basename}.${ext}`); } getOwnMusicVideoCoverPath(musicVideo) { @@ -1489,12 +1486,12 @@ export class Track extends Thing { ? '' : this.directory + '-'); - return [ - 'media.trackCover', - this.album.directory, - trackPrefix + musicVideo.unqualifiedDirectory, - musicVideo.coverArtFileExtension, - ]; + const filename = + trackPrefix + + musicVideo.unqualifiedDirectory + + `.${musicVideo.coverArtFileExtension}`; + + return this.album.getAlbumArtPath(filename); } countOwnContributionInContributionTotals(_contrib) { 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