Create extended M3U playlist from mpc playlist

Just a simple “oneliner” to create an .m3u file from an mpc playlist.
If you are statisfied with the output redirect stdout to myplaylist.m3u.

mpc -f "##EXTINF:%time%,%artist% - %title%\n%file%" playlist | perl -F: -p -e 'if (/^#EXTINF/) {$sec=$F[1]*60; $F[2] =~ s/(^.+),/$1/; $sec += $F[2]; s/^.+,(.+)/#EXTINF:$sec,$1/;}'

Leave a Reply

Your email address will not be published / Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.