I enjoy listening to music while doing my work, but doing it with online radio is not really enjoyable as during daytime, it’s hard to listen to 128 kbps stream without buffering issue, thanks to TMNut’s Streamyx. Even if (at times) it’s ok, the bandwidth is better saved for other meaningful purposes. What I did was to create a script to dump the broadcast, run it by midnight (the time when the highways is clear for Streamyx) and stop it in the early morning. Let cron help you with this and it should make your life even easier.
In my example, I’m using 1.FM’s Channel X, and a lot more is available from www.shoutcast.com‘s playlists.
(Script updated on 20070301)
#!/bin/bash URL=http://126.96.36.199:8070 WORKDIR=/home/shakir/temp/mplayerdump MAXDUMP=3 CURRENTDUMP=`ls $WORKDIR | wc -l` mv $WORKDIR/current.mp3 $WORKDIR/`date +%F`.mp3 if [ $CURRENTDUMP -ge $MAXDUMP ] ; then for i in `ls $WORKDIR | head -n $[($CURRENTDUMP-$MAXDUMP)+1]`; do rm $WORKDIR/$i done fi mplayer -dumpstream $URL -dumpfile $WORKDIR/current.mp3 #ffmpeg -i $URL -ab 128 $WORKDIR/current.mp3