Skip to content

Instantly share code, notes, and snippets.

@bahamas10
Created March 27, 2013 04:39
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 bahamas10/5251690 to your computer and use it in GitHub Desktop.
Save bahamas10/5251690 to your computer and use it in GitHub Desktop.
create m3us for all free di.fm streams (great for mpd playlists)

di.fm m3u

run this to create m3u files for each free radio station that http://di.fm provides.

do this in a tempdir or something

egrep -o 'http://listen\.di\.fm/public3/.*\.pls' < <(curl -s http://www.di.fm/) | \
while read link; do
  data=$(curl "$link")
  name=$(awk -F" - " '/^Title1/ { print $2 }' <<< "$data")
  links=$(awk -F= '/^File/ { print $2 }' <<< "$data")
  echo "$links" > "$name.m3u"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment