Add song's duration

This commit is contained in:
Bingus_Violet 2024-01-25 23:03:05 -06:00
parent 81c4cbe14e
commit 90af4401e1

View file

@ -44,6 +44,17 @@ app.listen(PORT, () => {
console.log("Violet's Purgatory is now listening on port: " + PORT)
})
function timeFormatter(seconds) {
seconds = Math.ceil(seconds)
var minutes = 0
while (seconds > 60) {
seconds -= 60
minutes += 1
}
return `${minutes}:${seconds}`
}
function pageUpdate() {
var statuses = {
"online": {
@ -181,6 +192,7 @@ function pageUpdate() {
${songStats()}
<br>
<span class="lengthBar lengthBar${index}"><span></span></span>
${timeFormatter((activity.timestamps.end - activity.timestamps.start) / 1000)}
</p>
</div>