From f665b4de4f30484398bdc9986b0383802d3652a8 Mon Sep 17 00:00:00 2001 From: Florrie Date: Thu, 5 Mar 2020 20:51:16 -0400 Subject: cool stuff + variables on passed object --- upd8.js | 275 +++++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 186 insertions(+), 89 deletions(-) diff --git a/upd8.js b/upd8.js index 57605d17..c62d4590 100644 --- a/upd8.js +++ b/upd8.js @@ -76,8 +76,10 @@ const writeFile = util.promisify(fs.writeFile); const access = util.promisify(fs.access); const { + cacheOneArg, joinNoOxford, progressPromiseAll, + queue, s, splitArray, th @@ -93,7 +95,7 @@ const SITE_ABOUT = `

Welcome to my fan-made Homestuck music wiki!

Homestuck has always been an incredible creative collaboration, and especially beloved by the community and critical in that collaboration is the webcomic and world's humongous soundtrack, comprising well over 500 tracks by dozens of musicians and artists. This wiki aims to be an interesting and useful resource for anyone interested in that music, as well as an archive for all things related.

Pertaining to the history of this site: it was originally made as a remake of Homestuck's official Bandcamp, which saw its content particularly reduced on 10/25/19. This site aims to be a more reliable resource and reference: track art (conspicuously missing from the Bandcamp) is archived here, solo albums (among other missing albums, like Squiddles!) are all indexed in the one place, and URLs will always stay consistent. And of course, also included are links for listening on Bandcamp and other services.

-

Credits

+

Resource & Author Credits

+

Feature Acknowledgements

+

Thank you, GiovanH, for linking me to a resource for higher quality cover art, and bringing to my attention the fact that clicking a cover art on Bandcamp to zoom in will often reveal a higher quality image.

+

Thank you, cosmogonicalAuthor, for a variety of feature requests and comments! In particular: improving way the track list on author pages is sorted; expanding the introduction; expanding the introduction message to the website; and linking bonus art for Homestuck Vol. 5 - plus a few other good suggestions I haven't gotten to yet. Thanks!

+

Thank you, Monckat, for suggesting the album Strife 2 before I'd begun adding fandom-created albums and unofficial releases to this wiki.

+

Thank you, Kidpen, for suggesting the "Flashes that feature this track" feature.

+

Thanks for pointing out typos, errors in reference lists, and out of date details: cookiefonster, foreverFlummoxed.

`; const SITE_FEEDBACK = ` @@ -270,13 +278,45 @@ function getMultilineField(lines, name) { return listLines.map(line => line.slice(4)).join('\n'); }; -function getMultilineHTMLField(lines, name) { - const text = getMultilineField(lines, name); - return text && text.split('\n').map(line => line.startsWith(' `} @@ -797,7 +838,7 @@ async function writeTrackPage(track, albumData, flashData) { ${tracksReferenced.map(track => fixWS`
  • ${track.name} - by ${getArtistString(track.artists, albumData)} + by ${getArtistString(track.artists, D)}
  • `).join('\n')} @@ -811,7 +852,7 @@ async function writeTrackPage(track, albumData, flashData) { ${ttrCanon.map(track => fixWS`
  • ${track.name} - by ${getArtistString(track.artists, albumData)} + by ${getArtistString(track.artists, D)}
  • `).join('\n')} @@ -822,7 +863,7 @@ async function writeTrackPage(track, albumData, flashData) { ${ttrFanon.map(track => fixWS`
  • ${track.name} - by ${getArtistString(track.artists, albumData)} + by ${getArtistString(track.artists, D)}
  • `).join('\n')} @@ -838,13 +879,13 @@ async function writeTrackPage(track, albumData, flashData) { ${track.lyrics && fixWS`

    Lyrics:

    - ${track.lyrics} + ${transformMultiline(track.lyrics, D)}
    `} ${track.commentary && fixWS`

    Artist commentary:

    - ${track.commentary} + ${transformMultiline(track.commentary, D)}
    `} @@ -852,18 +893,17 @@ async function writeTrackPage(track, albumData, flashData) { `); } -async function writeArtistPages(albumData, flashData) { - await progressPromiseAll('Writing artist pages.', getArtistNames(albumData).map(artistName => writeArtistPage(artistName, albumData, flashData))); +async function writeArtistPages(D) { + await progressPromiseAll('Writing artist pages.', queue(D.artistNames.map(artistName => () => writeArtistPage(artistName, D)))); } -async function writeArtistPage(artistName, albumData, flashData) { - const allTracks = getAllTracks(albumData); - const tracks = sortByDate(allTracks.filter(track => ( +async function writeArtistPage(artistName, D) { + const tracks = sortByDate(D.allTracks.filter(track => ( track.artists.includes(artistName) || track.contributors.some(({ who }) => who === artistName) ))); - const artThings = sortByDate(albumData.concat(allTracks).filter(thing => (thing.coverArtists || []).some(({ who }) => who === artistName))); - const commentaryThings = sortByDate(albumData.concat(allTracks).filter(thing => thing.commentary && thing.commentary.includes('' + artistName + ':'))); + const artThings = sortByDate(D.albumData.concat(D.allTracks).filter(thing => (thing.coverArtists || []).some(({ who }) => who === artistName))); + const commentaryThings = sortByDate(D.albumData.concat(D.allTracks).filter(thing => thing.commentary && thing.commentary.includes('' + artistName + ':'))); // Shish! const kebab = getArtistDirectory(artistName); @@ -887,12 +927,12 @@ async function writeArtistPage(artistName, albumData, flashData) { who: artistName, what: track.contributors.filter(({ who }) => who === artistName).map(({ what }) => what).join(', ') }; - const flashes = getFlashesThatFeature(track, allTracks, flashData); + const flashes = getFlashesThatFeature(track, D); return fixWS`
  • ${track.name} - ${track.artists.includes(artistName) && track.artists.length > 1 && `(with ${getArtistString(track.artists.filter(a => a !== artistName), albumData)})`} - ${contrib.what && `(${getContributionString(contrib, tracks) || 'contributed'})`} + ${track.artists.includes(artistName) && track.artists.length > 1 && `(with ${getArtistString(track.artists.filter(a => a !== artistName), D)})`} + ${contrib.what && `(${getContributionString(contrib, D) || 'contributed'})`} ${flashes.length && `
    (Featured in ${joinNoOxford(flashes.map(getFlashLinkHTML))})
    `}
  • `; @@ -907,7 +947,7 @@ async function writeArtistPage(artistName, albumData, flashData) { ${thing.album ? fixWS` ${thing.name} ` : '(cover art)'} - ${contrib.what && `(${getContributionString(contrib, tracks)})`} + ${contrib.what && `(${getContributionString(contrib, D)})`} `; })} @@ -915,7 +955,7 @@ async function writeArtistPage(artistName, albumData, flashData) { ${commentaryThings.length && fixWS`

    Commentary

    ${albumChunkedList(commentaryThings, thing => { - const flashes = getFlashesThatFeature(thing, allTracks, flashData); + const flashes = getFlashesThatFeature(thing, D); return fixWS`
  • ${thing.album ? fixWS` @@ -960,12 +1000,12 @@ function albumChunkedList(tracks, getLI, showDate = true) { `; } -async function writeFlashPages(albumData, flashData) { - await progressPromiseAll('Writing Flash pages.', flashData.map(flash => flash.page && writeFlashPage(flash, albumData, flashData)).filter(Boolean)); +async function writeFlashPages(D) { + await progressPromiseAll('Writing Flash pages.', D.flashData.map(flash => flash.page && writeFlashPage(flash, D)).filter(Boolean)); } -async function writeFlashPage(flash, albumData, flashData) { - const allTracks = getAllTracks(albumData); +async function writeFlashPage(flash, D) { + const {allTracks, flashData} = D; const kebab = getFlashDirectory(flash); const index = `${FLASH_DIRECTORY}/${kebab}/index.html`; const act6 = flashData.findIndex(f => f.act.startsWith('Act 6')) @@ -1005,13 +1045,13 @@ async function writeFlashPage(flash, albumData, flashData) {

    Tracks featured in ${flash.name.replace(/\.$/, '')}: