04-16-2022, 01:54 PM
Here is a script that will display the playlist duration
5h 1m 27s
Code:
mpc playlist -f '%time%' | tr ':' ' ' | awk '
BEGIN {i = 0}
{i += $1*60 + $2}
END{
if (int(i/3600) > 0)
print int(i/3600) "h " int((i%3600)/60) "m " int(i%60) "s"
else if (int(i) > 0)
print int((i%3600)/60) "m " int(i%60) "s"
else
print "(empty)"
}
'
5h 1m 27s