1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
import {empty} from '#sugar';
export const description = `per-artist info & artwork gallery pages`;
// NB: See artist-alias.js for artist alias redirect pages.
export function targets({wikiData}) {
return wikiData.artistData.filter(artist => !artist.isAlias);
}
export function pathsForTarget(artist) {
const hasGalleryPage =
!empty(artist.tracksAsCoverArtist) ||
!empty(artist.albumsAsCoverArtist);
return [
{
type: 'page',
path: ['artist', artist.directory],
contentFunction: {
name: 'generateArtistInfoPage',
args: [artist],
},
},
hasGalleryPage && {
type: 'page',
path: ['artistGallery', artist.directory],
contentFunction: {
name: 'generateArtistGalleryPage',
args: [artist],
},
},
];
}
/*
const unbound_serializeArtistsAndContrib =
(key, {serializeContribs, serializeLink}) =>
(thing) => {
const {artists, contrib} = getArtistsAndContrib(thing, key);
const ret = {};
ret.link = serializeLink(thing);
if (contrib.what) ret.contribution = contrib.what;
if (!empty(artists)) ret.otherArtists = serializeContribs(artists);
return ret;
};
const unbound_serializeTrackListChunks = (chunks, {serializeLink}) =>
chunks.map(({date, album, chunk, duration}) => ({
album: serializeLink(album),
date,
duration,
tracks: chunk.map(({track}) => ({
link: serializeLink(track),
duration: track.duration,
})),
}));
const data = {
type: 'data',
path: ['artist', artist.directory],
data: ({serializeContribs, serializeLink}) => {
const serializeArtistsAndContrib = bindOpts(unbound_serializeArtistsAndContrib, {
serializeContribs,
serializeLink,
});
const serializeTrackListChunks = bindOpts(unbound_serializeTrackListChunks, {
serializeLink,
});
return {
albums: {
asCoverArtist: artist.albumsAsCoverArtist
.map(serializeArtistsAndContrib('coverArtistContribs')),
asWallpaperArtist: artist.albumsAsWallpaperArtist
.map(serializeArtistsAndContrib('wallpaperArtistContribs')),
asBannerArtist: artist.albumsAsBannerArtis
.map(serializeArtistsAndContrib('bannerArtistContribs')),
},
flashes: wikiInfo.enableFlashesAndGames
? {
asContributor: artist.flashesAsContributor
.map(flash => getArtistsAndContrib(flash, 'contributorContribs'))
.map(({contrib, thing: flash}) => ({
link: serializeLink(flash),
contribution: contrib.what,
})),
}
: null,
tracks: {
asArtist: artist.tracksAsArtist
.map(serializeArtistsAndContrib('artistContribs')),
asContributor: artist.tracksAsContributo
.map(serializeArtistsAndContrib('contributorContribs')),
chunked: serializeTrackListChunks(trackListChunks),
},
};
},
};
*/
|