From 8fd50d6f0ba8dcfcfe34eb1321dc0bdd307b8c6a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 5 May 2022 19:33:01 -0300 Subject: support albums without cover art --- src/util/wiki-data.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/util/wiki-data.js') diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js index 545e21e5..c0c6dc3d 100644 --- a/src/util/wiki-data.js +++ b/src/util/wiki-data.js @@ -98,7 +98,12 @@ export function filterAlbumsByCommentary(albums) { } export function getAlbumCover(album, {to}) { - return to('media.albumCover', album.directory, album.coverArtFileExtension); + // Some albums don't have art! This function returns null in that case. + if (album.hasCoverArt) { + return to('media.albumCover', album.directory, album.coverArtFileExtension); + } else { + return null; + } } export function getAlbumListTag(album) { @@ -155,8 +160,10 @@ export function getTotalDuration(tracks) { } export function getTrackCover(track, {to}) { - // Some al8ums don't have any track art at all, and in those, every track - // just inherits the al8um's own cover art. + // Some albums don't have any track art at all, and in those, every track + // just inherits the album's own cover art. Note that since cover art isn't + // guaranteed on albums either, it's possible that this function returns + // null! if (!track.hasCoverArt) { return getAlbumCover(track.album, {to}); } else { -- cgit 1.3.0-6-gf8a5