Is it possible to query the total time of a !songrequest list

Just wondering if its possible to display the total time of !songrequest playlist? I see the length of each song on the list but can you total the time of all of them?

If you hover over the Length label on the public song requests table, you can now see the total time of the queue. :thumbsup:

1 Like

Nice, thank you for that information. Sorry really new to the nightbot API is it possible to just pull that element into a twitch stream and display it. Will be looking on my own in the support pages didn’t know if you happen to have a good site for custom commands.

If you are a programmer, you could retrieve the song request queue from our API and loop through the array to calculate the total length: https://api-docs.nightbot.tv/#get-queue

On our site we use reduce to calculate the total time in seconds (which can then be translated into hours, minutes, and seconds).

data.queue.reduce(function(prev, current) {
    return prev + current.track.duration;
}, 0);

If you’re not a programmer, we don’t currently have a tool to do that, sorry.

Cool, will give that a shot, thanks again for everything!