#!/bin/bash # This script is based on one found in what is assumed to be the public domain. set -e playlist=/var/local/bbc_radio/urls rm -f $playlist declare -A radios radios["BBC1"]="http://www.radiofeeds.co.uk/bbcradio1.pls" radios["BBC1x"]="http://www.radiofeeds.co.uk/bbc1xtra.pls" radios["BBC2"]="http://www.radiofeeds.co.uk/bbcradio2.pls" radios["BBC3"]="http://www.radiofeeds.co.uk/bbcradio3.pls" radios["BBC4"]="http://www.radiofeeds.co.uk/bbcradio4fm.pls" radios["BBC4x"]="http://www.radiofeeds.co.uk/bbcradio4extra.pls" radios["BBC5l"]="http://www.radiofeeds.co.uk/bbc5live.pls" radios["BBC5lx"]="http://www.radiofeeds.co.uk/bbc5livesportsextra.pls" radios["BBC6"]="http://www.radiofeeds.co.uk/bbc6music.pls" for k in "${!radios[@]}" do pls=${radios[$k]} curl -s $pls | grep File1 | sed "s/File1=/$k, /" >> "$playlist" done