I want to display the total time of the current MPD playlist in vimus, or if that's not possible, at least on the command-line (so I can display it in i3bar). How do I do that?


Found it, with the help of a friend. This solution ignores the time already elapsed in the current song, but heh, good enough. In the command-line:

mpc playlist -f '%time%' | tr ':' ' ' | awk '
    BEGIN {i = 0}
    {i += $1*60 + $2}
        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"
            print "(empty)"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.