Bash script for listening to online BBC radio stations using Mplayer and Linux

Here is a bash script for listening to BBC streaming Radio stations using mplayer. I modified it as the old real audio scripts were not working anymore. I also included all the available BBC radio stations and made the help output more descriptive.

The list of bbc radio streams used in the script can be found at BBCStreams

To install, first install mplayer

sudo apt-get install mplayer

Then save the code below as a text file (ie bbcradio) and make executable.

chmod a+x bbcradio

link to download the BBCRadio script

You may find that the streams don't play on the newer versions of mplayer because of this bug in mplayer. In this case you can still stream the station. Do a wget on the .asx playlist file, in this file will be a mms link copy one of these links and use that link with mplayer on the command line instead, hope mplayer get round to fixing the bug soon! Here's an example for radio 2

mplayer mms://wmlive-acl.bbc.net.uk/wms/bbc_ami/radio2/radio2_bb_live_ep1_sl0

bbc radio bash shell script code

#!/bin/bash bbc[0]="" bbc[1]="http://bbc.co.uk/radio/listen/live/r1.asx" bbc[2]="http://bbc.co.uk/radio/listen/live/r1x.asx" bbc[3]="http://bbc.co.uk/radio/listen/live/r2.asx" bbc[4]="http://bbc.co.uk/radio/listen/live/r3.asx" bbc[5]="http://bbc.co.uk/radio/listen/live/r4.asx" bbc[6]="http://bbc.co.uk/radio/listen/live/r4lw.asx" bbc[7]="http://bbc.co.uk/radio/listen/live/r5l.asx" bbc[8]="http://bbc.co.uk/radio/listen/live/r5lsp.asx" bbc[9]="http://bbc.co.uk/radio/listen/live/r6.asx" bbc[10]="http://www.bbc.co.uk/radio/listen/live/r4x.asx" bbc[11]="http://bbc.co.uk/radio/listen/live/ran.asx" bbc[12]="http://www.bbc.co.uk/worldservice/meta/tx/nb/live_infent_au_nb.asx" bbc[13]="http://www.bbc.co.uk/worldservice/meta/tx/nb/live/eneuk.asx" bbc[14]="http://www.radiofeeds.co.uk/ws.asx" bbc[15]="http://www.bbc.co.uk/worldservice/meta/tx/nb/live_ennws_au_nb.asx" bbc[16]="http://www.bbc.co.uk/arabic/meta/tx/nb/arabic_live_au_nb.asx" bbc[17]="http://www.bbc.co.uk/russian/meta/tx/nb/russian_live_au_nb.asx" bbc[18]="http://bbc.co.uk/radio/listen/live/rc.asx" bbc[19]="http://bbc.co.uk/radio/listen/live/rf.asx" bbc[20]="http://bbc.co.uk/radio/listen/live/rng.asx" bbc[21]="http://bbc.co.uk/radio/listen/live/rs.asx" bbc[22]="http://bbc.co.uk/radio/listen/live/ru.asx" bbc[23]="http://bbc.co.uk/radio/listen/live/rw.asx" bbc[24]="http://bbc.co.uk/radio/listen/live/bbcberkshire.asx" bbc[25]="http://bbc.co.uk/radio/listen/live/bbcbristol.asx" bbc[26]="http://bbc.co.uk/radio/listen/live/bbccambridgeshire.asx" bbc[27]="http://bbc.co.uk/radio/listen/live/bbccornwall.asx" bbc[28]="http://bbc.co.uk/radio/listen/live/bbccoventryandwarwickshire.asx" bbc[29]="http://bbc.co.uk/radio/listen/live/bbccumbria.asx" bbc[30]="http://bbc.co.uk/radio/listen/live/bbcderby.asx" bbc[31]="http://bbc.co.uk/radio/listen/live/bbcdevon.asx" bbc[32]="http://bbc.co.uk/radio/listen/live/bbcessex.asx" bbc[33]="http://bbc.co.uk/radio/listen/live/bbcgloucestershire.asx" bbc[34]="http://bbc.co.uk/radio/listen/live/bbcguernsey.asx" bbc[35]="http://bbc.co.uk/radio/listen/live/bbcherefordandworcester.asx" bbc[36]="http://bbc.co.uk/radio/listen/live/bbchumberside.asx" bbc[37]="http://bbc.co.uk/radio/listen/live/bbcjersey.asx" bbc[38]="http://bbc.co.uk/radio/listen/live/bbckent.asx" bbc[39]="http://bbc.co.uk/radio/listen/live/bbclancashire.asx" bbc[40]="http://bbc.co.uk/radio/listen/live/bbcleeds.asx" bbc[41]="http://bbc.co.uk/radio/listen/live/bbcleicester.asx" bbc[42]="http://bbc.co.uk/radio/listen/live/bbclincolnshire.asx" bbc[43]="http://bbc.co.uk/radio/listen/live/bbclondon.asx" bbc[44]="http://bbc.co.uk/radio/listen/live/bbcmanchester.asx" bbc[45]="http://bbc.co.uk/radio/listen/live/bbcmerseyside.asx" bbc[46]="http://bbc.co.uk/radio/listen/live/bbcnewcastle.asx" bbc[47]="http://bbc.co.uk/radio/listen/live/bbcnorfolk.asx" bbc[48]="http://bbc.co.uk/radio/listen/live/bbcnorthampton.asx" bbc[49]="http://bbc.co.uk/radio/listen/live/bbcnottingham.asx" bbc[50]="http://bbc.co.uk/radio/listen/live/bbcoxford.asx" bbc[51]="http://bbc.co.uk/radio/listen/live/bbcsheffield.asx" bbc[52]="http://bbc.co.uk/radio/listen/live/bbcshropshire.asx" bbc[53]="http://bbc.co.uk/radio/listen/live/bbcsolent.asx" bbc[54]="http://bbc.co.uk/radio/listen/live/bbcsomerset.asx" bbc[55]="http://bbc.co.uk/radio/listen/live/bbcstoke.asx" bbc[56]="http://bbc.co.uk/radio/listen/live/bbcsuffolk.asx" bbc[57]="http://bbc.co.uk/radio/listen/live/bbcsurrey.asx" bbc[58]="http://bbc.co.uk/radio/listen/live/bbctees.asx" bbc[59]="http://bbc.co.uk/radio/listen/live/bbcthreecounties.asx" bbc[60]="http://bbc.co.uk/radio/listen/live/bbcwiltshire.asx" bbc[61]="http://bbc.co.uk/radio/listen/live/bbcwm.asx" bbc[62]="http://bbc.co.uk/radio/listen/live/bbcyork.asx" bbcl[0]="" bbcl[1]="BBC Radio 1" bbcl[2]="BBC Radio 1xtra" bbcl[3]="BBC Radio 2" bbcl[4]="BBC Radio 3" bbcl[5]="BBC Radio 4" bbcl[6]="BBC Radio 4 Long Wave LW" bbcl[7]="BBC Radio 5 Live" bbcl[8]="BBC Radio 5 Live Sports Extra" bbcl[9]="BBC Radio 6" bbcl[10]="BBC Radio 4 Extra" bbcl[11]="BBC Asian Network" bbcl[12]="BBC Radio World Service" bbcl[13]="BBC Radio World Service English (UK Schedule)" bbcl[14]="BBC Radio World Service (Alternative Stream)" bbcl[15]="BBC World Service 24 Hour News Channel" bbcl[16]="BBC Radio Arabic" bbcl[17]="BBC Radio Russia" bbcl[18]="BBC Radio Cymru" bbcl[19]="BBC Radio Foyle" bbcl[20]="BBC Radio nan Gaidheal" bbcl[21]="BBC Radio Scotland" bbcl[22]="BBC Radio Ulster" bbcl[23]="BBC Radio Wales" bbcl[24]="BBC Radio Berkshire" bbcl[25]="BBC Radio Bristol" bbcl[26]="BBC Radio Cambridgeshire" bbcl[27]="BBC Radio Cornwall" bbcl[28]="BBC Radio Coventry & Warwickshire" bbcl[29]="BBC Radio Cumbria" bbcl[30]="BBC Radio Derby" bbcl[31]="BBC Radio Devon" bbcl[32]="BBC Radio Essex" bbcl[33]="BBC Radio Gloucestershire" bbcl[34]="BBC Radio Guernsey" bbcl[35]="BBC Radio Hereford & Worcester" bbcl[36]="BBC Radio Humberside" bbcl[37]="BBC Radio Jersey" bbcl[38]="BBC Radio Kent" bbcl[39]="BBC Radio Lancashire" bbcl[40]="BBC Radio Leeds" bbcl[41]="BBC Radio Leicester" bbcl[42]="BBC Radio Lincolnshire" bbcl[43]="BBC Radio London" bbcl[44]="BBC Radio Manchester" bbcl[45]="BBC Radio Merseyside" bbcl[46]="BBC Radio Newcastle" bbcl[47]="BBC Radio Norfolk" bbcl[48]="BBC Radio Northampton" bbcl[49]="BBC Radio Nottingham" bbcl[50]="BBC Radio Oxford" bbcl[51]="BBC Radio Sheffield" bbcl[52]="BBC Radio Shropshire" bbcl[53]="BBC Radio Solent" bbcl[54]="BBC Radio Somerset" bbcl[55]="BBC Radio Stoke" bbcl[56]="BBC Radio Suffolk" bbcl[57]="BBC Radio Surrey" bbcl[58]="BBC Radio Tees" bbcl[59]="BBC Radio Three Counties" bbcl[60]="BBC Radio Wiltshire" bbcl[61]="BBC Radio West Midlands" bbcl[62]="BBC Radio York" if [ $# -eq 0 ] then echo "usage bbc 1" for ((i=0; i<${#bbc[@]}; i++)) do echo $i . ${bbcl[$i]} done exit 1 fi mplayer -quiet -playlist ${bbc[${1}]}