« get me outta code hell

chunk artist track lists by original date again! - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-03-29 14:36:30 -0300
committer(quasar) nebula <towerofnix@gmail.com>2021-03-29 14:36:30 -0300
commit5359233d272e4e7397b8cb81e7c1711e0f414240 (patch)
tree2ef184ae116e52cb5e78cdbbe7f7b870e1be3c90
parent679ef8d0a1e32055fb353f2dd3a47b6d4c178743 (diff)
chunk artist track lists by original date again!
i.e, show and chunk by original & art release dates as appropriate.
-rwxr-xr-xupd8.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/upd8.js b/upd8.js
index 74b4a67b..cb351940 100755
--- a/upd8.js
+++ b/upd8.js
@@ -3068,9 +3068,10 @@ function writeArtistPage(artist) {
             .map(props => ({
                 album: thing.album || thing,
                 track: thing.album ? thing : null,
+                date: +(thing.coverArtDate || thing.date),
                 ...props
             })))
-    ), ['album']);
+    ), ['date', 'album']);
 
     const commentaryListChunks = chunkByProperties(commentaryThings.map(thing => ({
         album: thing.album || thing,
@@ -3084,6 +3085,7 @@ function writeArtistPage(artist) {
     const chunkTracks = tracks => (
         chunkByProperties(tracks.map(track => ({
             track,
+            date: +track.date,
             album: track.album,
             duration: track.duration,
             artists: (track.artists.some(({ who }) => who === artist)
@@ -3096,9 +3098,9 @@ function writeArtistPage(artist) {
                     track.contributors.find(({ who }) => who === artist)?.what
                 ].filter(Boolean).join(', ')
             }
-        })), ['album'])
-        .map(({album, chunk}) => ({
-            album, chunk,
+        })), ['date', 'album'])
+        .map(({date, album, chunk}) => ({
+            date, album, chunk,
             duration: getTotalDuration(chunk),
         })));
 
@@ -3165,10 +3167,10 @@ function writeArtistPage(artist) {
 
     const generateTrackList = (chunks, {strings, to}) => fixWS`
         <dl>
-            ${chunks.map(({album, chunk, duration}) => fixWS`
+            ${chunks.map(({date, album, chunk, duration}) => fixWS`
                 <dt>${strings('artistPage.creditList.album.withDate.withDuration', {
                     album: strings.link.album(album, {to}),
-                    date: strings.count.date(album.date),
+                    date: strings.count.date(date),
                     duration: strings.count.duration(duration, {approximate: true})
                 })}</dt>
                 <dd><ul>
@@ -3277,10 +3279,10 @@ function writeArtistPage(artist) {
                                 })))
                         })}</p>
                         <dl>
-                            ${artListChunks.map(({album, chunk}) => fixWS`
+                            ${artListChunks.map(({date, album, chunk}) => fixWS`
                                 <dt>${strings('artistPage.creditList.album.withDate', {
                                     album: strings.link.album(album, {to}),
-                                    date: strings.count.date(album.date)
+                                    date: strings.count.date(date)
                                 })}</dt>
                                 <dd><ul>
                                     ${(chunk