Using Rasberry pi for timeshifting (recording) webradio.

Since my volumio Pi is on most of the time , I got the idea of having it record webradio streams of radio shows when I am not around to listen. This is pretty easy to do using an already available tool called ‘streamripper’. You must be able to log into your volumio RPi with ssh , then use the bash shell to do this. You also need enough extra room on your microsd card to store the recordings. You can install streamripper simply with ‘sudo apt-get streamripper’. After that you need some way to start streamripper at the appointed time, Im using the ‘at’ daemon , cron could also be used. These are both disabled by default in the file ‘/var/www/command/’ , comment out the line ‘killall -9 atd’ and reboot. You must then set your local timezone rather than the default of UTC with ‘sudo dpkg-reconfigure tzdata’ . Once your RPi is displaying the correct local time you can log into to it with ssh and use a simple bash script to set streamripper to record from the desired station link in your WEBRADIO directory.

I’m using this simple script to set the recordings.

# use webrecord [.pls , .m3u] time minutes
if [ "$#" -ne 3 ];then
	echo "Useage:webrecord [.pls , m3u] (recording start time) (number of minutes to record)"
	exit 1

STATION_URL=$(grep -h -m1 -oP "http://[^'\n\t\r]+" "$1")
SECONDS=$(($3 * 60))
STREAM_DIR=/mnt/MICROSD/Streamrips  <------replace this with the path where you want your recordings.

echo Webrecord from:$STATION_URL For:$SECONDS AT:$2

echo "streamripper $STATION_URL -a -d $STREAM_DIR -l $SECONDS" | at "$2"

So to set a recording just ssh to volumio and do a ‘webrecord /var/lib/mpd/music/WEBRADIO/somestation.pls 7:00am 120’ and thats it. You can check to see that ‘at’ is set to run webrecord at the set time with ‘atq’ , pending jobs can be removed with ‘atrm’.

Nice, thanks, how should be this done on Volumio 2 please ? not found.