====== MusicPlayer Daemon ======
[http://www.musicpd.org mpd] is the best music player software I know of!
===== Browser Integration =====
The problem is having a script extracting the URLs contained in ''pls'' or
''m3u'' playlists and adding them to mpd's playlist.
The following two scripts just do what is necessary:
* clearing the playlist
* extracting the URLs
* adding them to the playlist
==== PLS Format ====
#!/bin/env sh
mpc clear
grep '^File[0-9]*' $1 | sed -e 's/^File[0-9]*=//' | mpc add
mpc play
==== M3U Format ====
#!/bin/env sh
mpc clear
cat $1 | mpc add
mpc play
==== Combined Script For Both Formats ====
#!/bin/env sh
mpc clear
if [[ "$1" = *.pls ]]; then
awk -v 'FS==' '/^File[0-9]*/ {print $2}' "$1"
elif [[ "$1" = *.m3u ]]; then
cat "$1"
fi | mpc add
mpc play