« get me outta code hell

wiki-wide stats & group lengths on album pages - 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>2020-12-11 19:35:26 -0400
committer(quasar) nebula <towerofnix@gmail.com>2020-12-11 19:35:26 -0400
commit263fe0e0fb2ea556e5e5daf298fbadd36531335a (patch)
treed97ddda80394dfb486691d372d125918fae369e9
parent6d06942aec9ec1edbd47ddaac4370286a5cb3ab8 (diff)
wiki-wide stats & group lengths on album pages
-rw-r--r--upd8.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/upd8.js b/upd8.js
index a2a5e27a..f1f254f8 100644
--- a/upd8.js
+++ b/upd8.js
@@ -1525,7 +1525,7 @@ async function writeAlbumPage(album) {
                         ${album.tracks.flatMap((track, i, arr) => [
                             (i > 0 && track.group !== arr[i - 1].group) && `</${listTag}></dd>`,
                             (i === 0 || track.group !== arr[i - 1].group) && fixWS`
-                                ${track.group && `<dt>${track.group}:</dt>`}
+                                ${track.group && `<dt>${track.group} (~${getDurationString(getTotalDuration(album.tracks.filter(({ group }) => group === track.group)))}):</dt>`}
                                 <dd><${listTag === 'ol' ? `ol start="${i + 1}"` : listTag}>
                             `,
                             trackToListItem(track),
@@ -2344,6 +2344,9 @@ function writeListingPages() {
         return `${Math.floor(wordCount / 100) / 10}k`;
     };
 
+    const releasedTracks = allTracks.filter(track => track.album.directory !== C.UNRELEASED_TRACKS_DIRECTORY);
+    const releasedAlbums = albumData.filter(album => album.directory !== C.UNRELEASED_TRACKS_DIRECTORY);
+
     return progressPromiseAll(`Writing listing pages.`, [
         writePage([C.LISTING_DIRECTORY], {
             title: `Listings Index`,
@@ -2351,6 +2354,8 @@ function writeListingPages() {
             main: {
                 content: fixWS`
                     <h1>Listings</h1>
+                    <p>${SITE_TITLE}: <b>${releasedTracks.length}</b> tracks across <b>${releasedAlbums.length}</b> albums, totaling <b>~${getDurationString(getTotalDuration(releasedTracks))}</b> ${getTotalDuration(releasedTracks) > 3600 ? 'hours' : 'minutes'}.</p>
+                    <hr>
                     <p>Feel free to explore any of the listings linked below and in the sidebar!</p>
                     ${generateLinkIndexForListings(listingDescriptors)}
                 `