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
|
export default {
contentDependencies: [
'generateSocialEmbed',
'generateTrackSocialEmbedDescription',
],
extraDependencies: ['absoluteTo', 'language', 'urls'],
relations(relation, track) {
return {
socialEmbed:
relation('generateSocialEmbed'),
description:
relation('generateTrackSocialEmbedDescription', track),
};
},
data(track) {
const {album} = track;
const data = {};
data.trackName = track.name;
data.albumName = album.name;
data.trackDirectory = track.directory;
data.albumDirectory = album.directory;
if (track.hasUniqueCoverArt) {
data.imageSource = 'track';
data.coverArtFileExtension = track.coverArtFileExtension;
} else if (album.hasCoverArt) {
data.imageSource = 'album';
data.coverArtFileExtension = album.coverArtFileExtension;
} else {
data.imageSource = 'none';
}
return data;
},
generate(data, relations, {absoluteTo, language, urls}) {
return relations.socialEmbed.slots({
title:
language.$('trackPage.socialEmbed.title', {
track: data.trackName,
}),
headingContent:
language.$('trackPage.socialEmbed.heading', {
album: data.albumName,
}),
headingLink:
absoluteTo('localized.album', data.albumDirectory),
imagePath:
(data.imageSource === 'album'
? '/' +
urls
.from('shared.root')
.to('media.albumCover', data.albumDirectory, data.coverArtFileExtension)
: data.imageSource === 'track'
? '/' +
urls
.from('shared.root')
.to('media.trackCover', data.albumDirectory, data.trackDirectory, data.coverArtFileExtension)
: null),
});
},
};
/*
socialEmbed: {
heading: language.$('trackPage.socialEmbed.heading', {
album: track.album.name,
}),
headingLink: absoluteTo('localized.album', album.directory),
title: language.$('trackPage.socialEmbed.title', {
track: track.name,
}),
description: getSocialEmbedDescription({getArtistString, language}),
image: '/' + getTrackCover(track, {to: urls.from('shared.root').to}),
color: track.color,
},
*/
|