From 63070dd61053a7b34f76583c7dd441bb758e8188 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 6 Feb 2021 15:17:41 -0400 Subject: credit wallpapers on artist pages (but not artist gallery pages!) --- upd8.js | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/upd8.js b/upd8.js index dabc4da..d2ad369 100755 --- a/upd8.js +++ b/upd8.js @@ -2311,7 +2311,8 @@ async function writeArtistPage(artist) { note = '' } = artist; - const artThings = C.sortByDate([...artist.tracks.asCoverArtist, ...artist.albums.asCoverArtist]); + const artThingsAll = C.sortByDate(Array.from(new Set([...artist.tracks.asCoverArtist, ...artist.albums.asCoverArtist, ...artist.albums.asWallpaperArtist]))); + const artThingsGallery = C.sortByDate([...artist.tracks.asCoverArtist, ...artist.albums.asCoverArtist]); const commentaryThings = C.sortByDate([...artist.tracks.asCommentator, ...artist.albums.asCommentator]); let flashes; @@ -2366,13 +2367,13 @@ async function writeArtistPage(artist) {
`} ${urls.length && `

Visit on ${joinNoOxford(urls.map(fancifyURL), 'or')}.

`} - ${artThings.length && `

View art gallery!

`} + ${artThingsGallery.length && `

View art gallery!

`}

Jump to: ${[ [ [...releasedTracks, ...unreleasedTracks].length && `Tracks`, unreleasedTracks.length && `(Unreleased Tracks)` ].filter(Boolean).join(' '), - artThings.length && `Art`, + artThingsAll.length && `Art`, wikiInfo.features.flashesAndGames && flashes.length && `Flashes & Games`, commentaryThings.length && `Commentary` ].filter(Boolean).join(', ')}.

@@ -2387,20 +2388,27 @@ async function writeArtistPage(artist) {

Unreleased Tracks

${generateTrackList(unreleasedTracks)} `} - ${artThings.length && fixWS` + ${artThingsAll.length && fixWS`

Art

-

View art gallery! Or browse the list:

- ${albumChunkedList(artThings, (thing, i) => { - const contrib = thing.coverArtists.find(({ who }) => who === artist); - return fixWS` + ${artThingsGallery.length && `

View art gallery! Or browse the list:

`} + ${albumChunkedList(artThingsAll, (thing, i) => { + const cover = { + artists: thing.coverArtists, + contrib: thing.coverArtists.find(({ who }) => who === artist) + }; + const bg = { + artists: thing.wallpaperArtists, + contrib: thing.wallpaperArtists?.find(({ who }) => who === artist) + }; + return [cover, bg].filter(x => x.contrib).map(({ artists, contrib }) => fixWS`
  • ${thing.album ? fixWS` ${thing.name} - ` : '(cover art)'} - ${thing.coverArtists.length > 1 && `(with ${getArtistString(thing.coverArtists.filter(({ who }) => who !== artist))})`} + ` : (contrib === bg.contrib) ? '(wallpaper art)' : '(cover art)'} + ${artists.length > 1 && `(with ${getArtistString(artists.filter(({ who }) => who !== artist))})`} ${contrib.what && `(${getContributionString(contrib)})`}
  • - `; + `).join('\n'); }, true, 'coverArtDate')} `} ${wikiInfo.features.flashesAndGames && flashes.length && fixWS` @@ -2440,7 +2448,7 @@ async function writeArtistPage(artist) { wikiInfo.features.listings && [`${C.LISTING_DIRECTORY}/`, 'Listings'], [null, 'Artist:'], [`${C.ARTIST_DIRECTORY}/${artist.directory}/`, name], - artThings.length && [null, `(${[ + artThingsGallery.length && [null, `(${[ `Info`, `Gallery` ].join(', ')})`] @@ -2448,7 +2456,7 @@ async function writeArtistPage(artist) { } }); - if (artThings.length) { + if (artThingsGallery.length) { await writePage([C.ARTIST_DIRECTORY, artist.directory, 'gallery'], { title: name + ' - Gallery', @@ -2456,10 +2464,10 @@ async function writeArtistPage(artist) { classes: ['top-index'], content: fixWS`

    ${name} - Gallery

    -

    (Contributed to ${s(artThings.length, 'cover art')})

    +

    (Contributed to ${s(artThingsGallery.length, 'cover art')})

    ${getGridHTML({ - entries: artThings.map(item => ({item})), + entries: artThingsGallery.map(item => ({item})), srcFn: thing => (thing.album ? getTrackCover(thing) : getAlbumCover(thing)), @@ -2791,6 +2799,7 @@ function writeListingPages() { contribs: ( artist.tracks.asCoverArtist.length + artist.albums.asCoverArtist.length + + artist.albums.asWallpaperArtist.length + (wikiInfo.features.flashesAndGames ? artist.flashes.asContributor.length : 0) ) })) @@ -4090,6 +4099,7 @@ async function main() { ...albumData.flatMap(album => [ ...album.artists || [], ...album.coverArtists || [], + ...album.wallpaperArtists || [], ...album.tracks.flatMap(track => [ ...track.artists, ...track.coverArtists || [], @@ -4371,7 +4381,8 @@ async function main() { artist.albums = { asArtist: filterProp(albumData, 'artists'), asCommentator: filterCommentary(albumData), - asCoverArtist: filterProp(albumData, 'coverArtists') + asCoverArtist: filterProp(albumData, 'coverArtists'), + asWallpaperArtist: filterProp(albumData, 'wallpaperArtists') }; if (wikiInfo.features.flashesAndGames) { artist.flashes = { -- cgit 1.3.0-6-gf8a5