just listen…

22 07 2011

so. you want to listen to your favourite internet radio station in the console? not a problem with today’s script. all you additionally need is a playlists-folder where you store your onlineradio-playlist-files.

Usage:
$ listen sputnik
whereas sputnik is a playlist file in the playlists-folder (see below)

Newer versions of mplayer are able to capture the current audio stream using the -capture option, combined with the -dumpfile argument. Using this you can record the current stream pressing the ‘c’ key on the keyboard. Note that if you repeatedly press the ‘c’ key, the sound will be appended. No new file is being created until you restart mplayer or rename the recorded file in between.
If your version of mplayer does not support this option use the line without -capture and -dumpfile.

#!/bin/bash
# folder
plfolder="~/music/.playlists"
capturefile=~/radio_$1_$(date +%Y%m%d_%H%M).mp3
# if help is wanted...list the files in the playlist-folder
if [ "$1" = '--help' ] || [ "$1" = "-h" ] || [ "$1" = "help" ]
then  ls $plfolder
 exit 1
fi

clear
echo Tuning in to $1 
# version with capture option (newer versions of mplayer)
mplayer -capture -loop 0 -playlist ${plfolder}/$1  -dumpfile $capturefile
# version without capture option (older versions)
# mplayer -loop 0 -playlist ${plfolder}/$1


some example playlist files:
(somehow the http creates empty lines that were not intended – just cancel out all empty lines in your local playlist files)

sputnik – alternative radio stations (mdr, germany)










top40 – dance/party music

http://stream.hoerradar.de/mp3-radiotop40-192
http://stream.hoerradar.de/mp3-radiotop40-electro-192

chris – some christian internet radio staions

http://www.christianrock.net/CRDN/live/high.pls
http://www.christianhardrock.net/CHRDN/live2/high.pls
http://www.christian-hiphop.net/CHHDN/live/high.pls
http://www.christianpowerpraise.net/CPPDN/live/high.pls

norge – norwegian radio

mms://straumr.nrk.no/nrk_radio_mp3_m
mms://wms.yourstation.com/RadioTromsoLive
mms://straumr.nrk.no/nrk_radio_p1_m
mms://straumr.nrk.no/nrk_radio_p2_m
mms://straumr.nrk.no/nrk_radio_p3_m
#mms://straumr.nrk.no/nrk_radio_p3_urort_m
mms://straumr.nrk.no/nrk_radio_alltid_folkemusikk_m
mms://straumr.nrk.no/nrk_radio_alltid_nyheter_m
mms://straumr.nrk.no/nrk_radio_alltid_klassisk_m
mms://straumr.nrk.no/nrk_radio_barn_m

andes – music from the peru

http://74.55.180.162:8020
http://74.55.180.162:9304       
http://173.212.214.10:7148
http://173.212.214.10:8526

You may post your favourite radio station in the comments if you like to.

Advertisements