One tiny problem I found with MPC is that it didn't integrate as nicely with Firefox/Opera as I would wish, for example when I download a .m3u or .pls file I can't have the streams it points to added to the MPC playlist.
So the solution is:
#!/bin/bash if [ -z "$1" ]; then echo "Usage: `basename $0`" > /dev/sdterr exit fi url=$1 # Presumed to be a remote URL if [ ! -f "$1" ]; then tmpfile=`mktemp` wget --quiet -O "$tmpfile" "$1" && url=$tmpfile fi if [ ! -f "$url" ]; then echo "Error: cannot retrieve playlist" > /dev/stderr exit fi cat $url | grep -E '^File' | cut -f 2 -d '=' | xargs mpc add
Takes either a local file or a URL to the playlist as the first parameter and adds all streams/files to the MPC playlist.
Leave a Reply