From ba2e5e70900fb9f8f3cbf781e9ebdb74d42fd6cf Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 16 Nov 2020 11:52:35 -0400 Subject: bug fixes and divided artist listings plus some tweaks to changelog formatting --- upd8.js | 188 +++++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 140 insertions(+), 48 deletions(-) (limited to 'upd8.js') diff --git a/upd8.js b/upd8.js index 9fe75521..3218c472 100644 --- a/upd8.js +++ b/upd8.js @@ -1026,7 +1026,7 @@ async function writePage(directoryParts, { const layoutHTML = [ navHTML, sidebar.content ? fixWS` -
+
${sidebarHTML} ${mainHTML}
@@ -1617,7 +1617,7 @@ async function writeArtistPage(artistName) { ${track.name} ${track.artists.includes(artistName) && track.artists.length > 1 && `(with ${getArtistString(track.artists.filter(a => a !== artistName))})` || ``} ${contrib.what && `(${getContributionString(contrib) || 'contributed'})` || ``} - ${flashes.length && `
(Featured in ${joinNoOxford(flashes.map(getFlashLinkHTML))})
` || ``} + ${flashes.length && `
(Featured in ${joinNoOxford(flashes.map(flash => getFlashLinkHTML(flash)))})
` || ``} `; }); @@ -1690,7 +1690,7 @@ async function writeArtistPage(artistName) { ${thing.album ? fixWS` ${thing.name} ` : '(album commentary)'} - ${flashes.length && `
(Featured in ${joinNoOxford(flashes.map(getFlashLinkHTML))})
`} + ${flashes.length && `
(Featured in ${joinNoOxford(flashes.map(flash => getFlashLinkHTML(flash)))})
`} ` }, false)} @@ -1905,6 +1905,8 @@ async function writeFlashPage(flash) { function writeListingPages() { const allArtists = artistNames.slice().sort(); + const reversedTracks = allTracks.slice().reverse(); + const reversedThings = justEverythingMan.slice().reverse(); const getAlbumLI = (album, extraText = '') => fixWS`
  • @@ -1954,11 +1956,61 @@ function writeListingPages() { (${commentary} ${commentary === 1 ? 'entry' : 'entries'})
  • `)], - [['artists', 'by-contribs'], `Artists - by Contributions`, allArtists - .map(name => ({name, contribs: C.getArtistNumContributions(name, {albumData, allTracks, flashData})})) - .sort((a, b) => b.contribs - a.contribs) - .map(({ name }) => name) - .map(getArtistLI)], + [['artists', 'by-contribs'], `Artists - by Contributions`, fixWS` +
    +
    +

    Track Contributors

    +
      + ${allArtists + .map(name => ({ + name, + contribs: allTracks.filter(({ album, artists, contributors }) => + album?.directory !== C.UNRELEASED_TRACKS_DIRECTORY && + [ + ...artists, + ...contributors + ].some(({ who }) => who === name)).length + })) + .sort((a, b) => b.contribs - a.contribs) + .filter(({ contribs }) => contribs) + .map(({ name, contribs }) => fixWS` +
    • + ${name} + (${contribs} c.) +
    • + `) + .join('\n') + } +
    +
    +
    +

    Art & Flash Contributors

    +
      + ${allArtists + .map(name => ({ + name, + contribs: justEverythingMan.filter(({ album, contributors, coverArtists }) => ( + album?.directory !== C.UNRELEASED_TRACKS_DIRECTORY && + [ + ...!album && contributors || [], + ...coverArtists || [] + ].some(({ who }) => who === name) + )).length + })) + .sort((a, b) => b.contribs - a.contribs) + .filter(({ contribs }) => contribs) + .map(({ name, contribs }) => fixWS` +
    • + ${name} + (${contribs} c.) +
    • + `) + .join('\n') + } +
    +
    +
    + `], [['artists', 'by-duration'], `Artists - by Duration`, allArtists .map(name => ({name, duration: getTotalDuration( getTracksByArtist(name).filter(track => track.album.directory !== C.UNRELEASED_TRACKS_DIRECTORY)) @@ -1971,23 +2023,57 @@ function writeListingPages() { (~${getDurationString(duration)}) `)], - [['artists', 'by-latest'], `Artists - by Latest Contribution`, C.sortByDate(allArtists - .map(name => ({name, things: C.getThingsArtistContributedTo(name, {albumData, allTracks, flashData})})) - .map(({ name, things }) => ({name, things: things.filter(thing => !thing.album || thing.album.directory !== C.UNRELEASED_TRACKS_DIRECTORY)})) - .filter(({ things }) => things.length) - .map(({ name, things }) => ({name, date: new Date(things.reduce((date, thing) => Math.max(date, - (thing.coverArtists?.some(({ who }) => who === name) - ? thing.coverArtDate - : thing.date)), 0))})) - .sort((a, b) => a.name < b.name ? 1 : a.name > b.name ? -1 : 0) - ) - .reverse() - .map(({ name, date }) => fixWS` -
  • - ${name} - (${getDateString({date})}) -
  • - `)], + [['artists', 'by-latest'], `Artists - by Latest Contribution`, fixWS` +
    +
    +

    Track Contributors

    +
      + ${C.sortByDate(allArtists + .map(name => ({ + name, + date: reversedTracks.find(({ album, artists, contributors }) => ( + album.directory !== C.UNRELEASED_TRACKS_DIRECTORY && + [...artists, ...contributors].some(({ who }) => who === name) + ))?.date + })) + .filter(({ date }) => date) + .sort((a, b) => a.name < b.name ? 1 : a.name > b.name ? -1 : 0) + ).reverse().map(({ name, date }) => fixWS` +
    • + ${name} + (${getDateString({date})}) +
    • + `).join('\n')} +
    +
    +
    +

    Art & Flash Contributors

    +
      + ${C.sortByDate(allArtists + .map(name => { + const thing = reversedThings.find(({ album, coverArtists, contributors }) => ( + album?.directory !== C.UNRELEASED_TRACKS_DIRECTORY && + [...coverArtists || [], ...!album && contributors || []].some(({ who }) => who === name) + )); + return thing && { + name, + date: (thing.coverArtists?.some(({ who }) => who === name) + ? thing.coverArtDate + : thing.date) + }; + }) + .filter(Boolean) + .sort((a, b) => a.name < b.name ? 1 : a.name > b.name ? -1 : 0) + ).reverse().map(({ name, date }) => fixWS` +
    • + ${name} + (${getDateString({date})}) +
    • + `).join('\n')} +
    +
    +
    + `], [['tracks', 'by-name'], `Tracks - by Name`, allTracks.slice() .sort(sortByName) .map(track => fixWS` @@ -2068,7 +2154,7 @@ function writeListingPages() { -
    +
    @@ -2085,7 +2171,7 @@ function writeListingPages() { -
    +
    @@ -2138,7 +2224,7 @@ function writeListingPages() { -
    +
    @@ -2174,26 +2260,32 @@ function writeListingPages() { } function writeListingPage(directoryParts, title, items, listingDescriptors) { - return OLD_writePage([C.LISTING_DIRECTORY, ...directoryParts], title, fixWS` - - -
    - -
    -

    ${title}

    - ${typeof items === 'string' ? items : fixWS` -
      - ${items.join('\n')} -
    - `} -
    -
    - - `); + return writePage([C.LISTING_DIRECTORY, ...directoryParts], { + title, + + main: { + content: fixWS` +

    ${title}

    + ${typeof items === 'string' ? items : fixWS` +
      + ${items.join('\n')} +
    + `} + ` + }, + + sidebar: { + content: generateSidebarForListings(listingDescriptors, directoryParts) + }, + + nav: { + links: [ + ['./', 'HSMusic'], + [`${C.LISTING_DIRECTORY}/`, 'Listings'], + [`${C.LISTING_DIRECTORY}/${directoryParts.join('/')}/`, title] + ] + } + }); } function generateHeaderForListings(listingDescriptors, currentDirectoryParts) { -- cgit 1.3.0-6-gf8a5