From af96a35a38635e7e86d42003a374e9332e5acebe Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Fri, 21 Jul 2023 13:20:59 -0700 Subject: [PATCH] chore: drop time prop --- src/_data/music.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/_data/music.js b/src/_data/music.js index 2e1162fe..4ee34bd4 100644 --- a/src/_data/music.js +++ b/src/_data/music.js @@ -58,6 +58,7 @@ const getTracksOneHour = (tracks) => { const tracksOneHour = [] let trackIndex = 0 let trackTimer = 0 + while (trackTimer < TIMER_CEILING) { trackTimer = trackTimer + parseInt(tracks[trackIndex].duration) tracksOneHour.push(tracks[trackIndex]) @@ -77,15 +78,14 @@ const diffTracks = (cache, tracks) => { ) for (let i = 0; i < comparedTracks.length; i++) - diffedTracks[`${comparedTracks[i]?.id}-${comparedTracks[i].time}`] = comparedTracks[i] + diffedTracks[`${comparedTracks[i]?.id}-${comparedTracks[i].playTime}`] = comparedTracks[i] return diffedTracks } const formatTracks = (tracks) => { - const now = new Date().getTime() let formattedTracks = {} - let time = now + let time = new Date().getTime() Object.values(tracks).forEach((track) => { const artistFormatted = titleCase(aliasArtist(track.attributes['artistName'])) @@ -103,7 +103,6 @@ const formatTracks = (tracks) => { albumFormatted )}%20${encodeURI(artistFormatted)}`, id: track.id, - time: now, playTime: time - parseInt(track.attributes['durationInMillis']), duration: parseInt(track.attributes['durationInMillis']), }