chore: drop time prop
This commit is contained in:
parent
a4e8b0a81f
commit
af96a35a38
1 changed files with 3 additions and 4 deletions
|
@ -58,6 +58,7 @@ const getTracksOneHour = (tracks) => {
|
||||||
const tracksOneHour = []
|
const tracksOneHour = []
|
||||||
let trackIndex = 0
|
let trackIndex = 0
|
||||||
let trackTimer = 0
|
let trackTimer = 0
|
||||||
|
|
||||||
while (trackTimer < TIMER_CEILING) {
|
while (trackTimer < TIMER_CEILING) {
|
||||||
trackTimer = trackTimer + parseInt(tracks[trackIndex].duration)
|
trackTimer = trackTimer + parseInt(tracks[trackIndex].duration)
|
||||||
tracksOneHour.push(tracks[trackIndex])
|
tracksOneHour.push(tracks[trackIndex])
|
||||||
|
@ -77,15 +78,14 @@ const diffTracks = (cache, tracks) => {
|
||||||
)
|
)
|
||||||
|
|
||||||
for (let i = 0; i < comparedTracks.length; i++)
|
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
|
return diffedTracks
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatTracks = (tracks) => {
|
const formatTracks = (tracks) => {
|
||||||
const now = new Date().getTime()
|
|
||||||
let formattedTracks = {}
|
let formattedTracks = {}
|
||||||
let time = now
|
let time = new Date().getTime()
|
||||||
|
|
||||||
Object.values(tracks).forEach((track) => {
|
Object.values(tracks).forEach((track) => {
|
||||||
const artistFormatted = titleCase(aliasArtist(track.attributes['artistName']))
|
const artistFormatted = titleCase(aliasArtist(track.attributes['artistName']))
|
||||||
|
@ -103,7 +103,6 @@ const formatTracks = (tracks) => {
|
||||||
albumFormatted
|
albumFormatted
|
||||||
)}%20${encodeURI(artistFormatted)}`,
|
)}%20${encodeURI(artistFormatted)}`,
|
||||||
id: track.id,
|
id: track.id,
|
||||||
time: now,
|
|
||||||
playTime: time - parseInt(track.attributes['durationInMillis']),
|
playTime: time - parseInt(track.attributes['durationInMillis']),
|
||||||
duration: parseInt(track.attributes['durationInMillis']),
|
duration: parseInt(track.attributes['durationInMillis']),
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue