From 20da4bd0b8b939e3a072bf0f72ee7664f497cd90 Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Thu, 3 Dec 2020 15:56:49 -0500 Subject: [PATCH] Fix artist concat for spotify recently played --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index bd721670..6f33733b 100644 --- a/index.js +++ b/index.js @@ -184,7 +184,7 @@ app.use(bodyParser.json()); app.getAsync('/spotify/recent', async function (req, res) { const result = await spotifySource.getRecentlyPlayed({formatted: true}); - const artistTruncFunc = truncateStringToLength(Math.min(30, longestString(result.map(x => x.data.artist)))); + const artistTruncFunc = truncateStringToLength(Math.min(40, longestString(result.map(x => x.data.artists.join(' / ')).flat()))); const trackLength = longestString(result.map(x => x.data.track)) const plays = result.map((x) => { const { @@ -197,7 +197,7 @@ app.use(bodyParser.json()); const buildOpts = { include: ['time', 'timeFromNow'], transformers: { - artist: a => artistTruncFunc(a).padEnd(33), + artists: a => artistTruncFunc(a.join(' / ')).padEnd(33), track: t => t.padEnd(trackLength) } } -- 2.51.2