diff options
| 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 |
| commit | 9dc7c08e2fa7a0303fda3b9a687b55425c594aef (patch) | |
| tree | 7b7ed5843e48abd0a2d1058cfaa1294d0d0da87d /src/data/things | |
| parent | 3b4fb2fbd12348ee0f98dc18c8f456a72c7876f6 (diff) | |
data, urls: vgm-album-art and suchness preview
Diffstat (limited to 'src/data/things')
| -rw-r--r-- | src/data/things/Track.js | 23 | ||||
| -rw-r--r-- | src/data/things/album/Album.js | 67 |
2 files changed, 44 insertions, 46 deletions
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... |