« get me outta code hell

don't hard-code list of trackartless albums - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2019-11-13 16:44:24 -0400
committerFlorrie <towerofnix@gmail.com>2019-11-13 16:44:24 -0400
commita1e7f28c9ef78e8930c0763c1e201800a815b122 (patch)
tree4af655dbe1aad7248128e6a0fbb2ac8e007e0403
parent112e4e48cd29865efc5a1da736833f577a87b08a (diff)
don't hard-code list of trackartless albums
-rw-r--r--album/homestuck-vol-5/album.txt1
-rw-r--r--album/medium/album.txt1
-rw-r--r--album/squiddles/album.txt1
-rw-r--r--album/symphony-impossible-to-play/album.txt1
-rw-r--r--upd8.js10
5 files changed, 7 insertions, 7 deletions
diff --git a/album/homestuck-vol-5/album.txt b/album/homestuck-vol-5/album.txt
index 2eecb461..be7b31fa 100644
--- a/album/homestuck-vol-5/album.txt
+++ b/album/homestuck-vol-5/album.txt
@@ -1,5 +1,6 @@
 Album: Homestuck Vol. 5
 Date: June 13, 2010
+Track Art: none
 FG: #00aaff
 -------------------------------------------------------------------------------
 Track: Homestuck Anthem
diff --git a/album/medium/album.txt b/album/medium/album.txt
index 1623cdc5..457ee3b3 100644
--- a/album/medium/album.txt
+++ b/album/medium/album.txt
@@ -1,6 +1,7 @@
 Album: Medium
 Artist: Clark Powell
 Date: April 14, 2011
+Track Art: none
 FG: #22ccff
 -------------------------------------------------------------------------------
 Track: Light
diff --git a/album/squiddles/album.txt b/album/squiddles/album.txt
index a9013cbf..e9b09848 100644
--- a/album/squiddles/album.txt
+++ b/album/squiddles/album.txt
@@ -1,5 +1,6 @@
 Album: Squiddles!
 Date: August 26, 2010
+Track Art: none
 FG: #bb44ff
 -----------------------------------------------
 Track: Squiddles!
diff --git a/album/symphony-impossible-to-play/album.txt b/album/symphony-impossible-to-play/album.txt
index fbdad1cd..503d613d 100644
--- a/album/symphony-impossible-to-play/album.txt
+++ b/album/symphony-impossible-to-play/album.txt
@@ -1,6 +1,7 @@
 Album: Symphony Impossible to Play
 Artist: Clark Powell
 Date: August 1, 2012
+Track Art: none
 FG: #dd5544
 -------------------------------------------------------------------------------
 Track: I - Overture
diff --git a/upd8.js b/upd8.js
index 2855d19b..4b365758 100644
--- a/upd8.js
+++ b/upd8.js
@@ -221,6 +221,7 @@ async function processAlbumDataFile(file) {
     const albumName = getBasicField(albumSection, 'Album');
     const albumArtists = getListField(albumSection, 'Artists') || getListField(albumSection, 'Artist');
     const albumDate = getBasicField(albumSection, 'Date');
+    const noTrackArt = (getBasicField(albumSection, 'Track Art') === 'none');
     let albumDirectory = getBasicField(albumSection, 'Directory');
 
     // I don't like these varia8le names. I'm sorry. -- I only really use the
@@ -262,6 +263,7 @@ async function processAlbumDataFile(file) {
         date: dateValue,
         artists: albumArtists,
         directory: albumDirectory,
+        noTrackArt,
         theme: {
             fg: albumColorFG,
             bg: albumColorBG,
@@ -644,13 +646,7 @@ function getAlbumCover(album) {
 function getTrackCover(track) {
     // Some al8ums don't have any track art at all, and in those, every track
     // just inherits the al8um's own cover art.
-    // TODO: Don't hard-c8de this!
-    if ([
-        'homestuck-vol-5',
-        'squiddles',
-        'medium',
-        'symphony-impossible-to-play'
-    ].includes(track.album.directory)) {
+    if (track.album.noTrackArt) {
         return getAlbumCover(track.album);
     } else {
         return `${ALBUM_DIRECTORY}/${track.album.directory}/${track.directory}.jpg`;