« get me outta code hell

support albums without cover art - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-05-05 19:33:01 -0300
committer(quasar) nebula <qznebula@protonmail.com>2022-05-05 19:33:01 -0300
commit8fd50d6f0ba8dcfcfe34eb1321dc0bdd307b8c6a (patch)
treeb7bed8c523dcdfaa4eec7c89e311457400530807 /src/util
parente943484cf46cfe509b8d68fada06a760ae05545f (diff)
support albums without cover art
Diffstat (limited to 'src/util')
-rw-r--r--src/util/wiki-data.js13
1 files changed, 10 insertions, 3 deletions
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 {