Add song's duration
This commit is contained in:
parent
81c4cbe14e
commit
90af4401e1
1 changed files with 12 additions and 0 deletions
12
index.js
12
index.js
|
@ -44,6 +44,17 @@ app.listen(PORT, () => {
|
||||||
console.log("Violet's Purgatory is now listening on port: " + 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() {
|
function pageUpdate() {
|
||||||
var statuses = {
|
var statuses = {
|
||||||
"online": {
|
"online": {
|
||||||
|
@ -181,6 +192,7 @@ function pageUpdate() {
|
||||||
${songStats()}
|
${songStats()}
|
||||||
<br>
|
<br>
|
||||||
<span class="lengthBar lengthBar${index}"><span></span></span>
|
<span class="lengthBar lengthBar${index}"><span></span></span>
|
||||||
|
${timeFormatter((activity.timestamps.end - activity.timestamps.start) / 1000)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue