Skip to content

Instantly share code, notes, and snippets.

@alexjj
Created September 20, 2013 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexjj/6636721 to your computer and use it in GitHub Desktop.
Save alexjj/6636721 to your computer and use it in GitHub Desktop.
Convert BBC Radio playlists to use with mpd. e.g. on raspberry pi or other linux device
#!/bin/bash
set -e
playlistdir=/var/lib/mpd/playlists
declare -A radios
radios["BBC Radio 4"]="http://www.bbc.co.uk/radio/listen/live/r4_aaclca.pls"
radios["BBC Radio 2"]="http://www.bbc.co.uk/radio/listen/live/r2_aaclca.pls"
for k in "${!radios[@]}"
do
filepath="${playlistdir}/${k}.m3u"
rm -f "$filepath"
echo "#EXTM3U" >> "$filepath"
pls=${radios[$k]}
echo "#EXTINF:-1, BBC - $k" >> "$filepath"
curl -s $pls | grep File1 | sed 's/File1=\(.*\)/\1/' >> "$filepath"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment