Skip to content

Commit 20da4bd

Browse files
committed
Fix artist concat for spotify recently played
1 parent 307d52f commit 20da4bd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ app.use(bodyParser.json());
184184

185185
app.getAsync('/spotify/recent', async function (req, res) {
186186
const result = await spotifySource.getRecentlyPlayed({formatted: true});
187-
const artistTruncFunc = truncateStringToLength(Math.min(30, longestString(result.map(x => x.data.artist))));
187+
const artistTruncFunc = truncateStringToLength(Math.min(40, longestString(result.map(x => x.data.artists.join(' / ')).flat())));
188188
const trackLength = longestString(result.map(x => x.data.track))
189189
const plays = result.map((x) => {
190190
const {
@@ -197,7 +197,7 @@ app.use(bodyParser.json());
197197
const buildOpts = {
198198
include: ['time', 'timeFromNow'],
199199
transformers: {
200-
artist: a => artistTruncFunc(a).padEnd(33),
200+
artists: a => artistTruncFunc(a.join(' / ')).padEnd(33),
201201
track: t => t.padEnd(trackLength)
202202
}
203203
}

0 commit comments

Comments
 (0)