Skip to content

Instantly share code, notes, and snippets.

@cstroie
Created August 13, 2012 21:20
Show Gist options
  • Save cstroie/3344182 to your computer and use it in GitHub Desktop.
Save cstroie/3344182 to your computer and use it in GitHub Desktop.
Create playlists with all available stations of sky.fm, di.fm and JazzRadio and send them by email
#!/bin/sh
# Create playlists with all available stations of sky.fm, di.fm and JazzRadio and send them by email
# Create all playlists
for station in sky di jazz
do
for format in mp3 aac
do
`dirname $0`/radio2playlist $station $format
done
done
# Email them to
ls -l `dirname $0`/*.m3u | mutt -x -s "Radio playlists" -a `dirname $0`/*.m3u -- [email protected]
#!/bin/sh
# Create playlists with all available stations of sky.fm, di.fm and JazzRadio
# Select the station
if [ "$1" == "sky" ]
then
station="$1"
server="listen.sky.fm"
elif [ "$1" == "di" ]
then
station="$1"
server="listen.di.fm"
elif [ "$1" == "jazz" ]
then
station="$1"
server="listen.jazzradio.com"
else
echo "Unknown station."
exit 1
fi
shift 1
# Select the format
if [ "$1" == "mp3" ]
then
format="$1"
pathinfo="public3"
elif [ "$1" == "aac" ]
then
format="$1"
pathinfo="public1"
else
echo "Unknown format."
exit 2
fi
shift 1
# Download
wget -q -O - "http://$server/$pathinfo" | grep -o '"playlist":"[^"]*"' | sed 's/"playlist":"\([^"]*\)"/\1/g' | sort | xargs -n 1 wget -q -O - | sed -n 's/^File1=//p' > "$station"-"$format".m3u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment