Mac/Linux/Unix: Record internet radios to listen them later with streamripper

I wanted to record Internet radios to listen to it later on (say at work), with fixed length files, and the name of the radio in the file names. I was not totally convinced by Radio Lover.

Here is my solution based on streamripper, an open-source tool.

You will need to save the following script as “ripstream-fake-trackinfo”:

#!/bin/sh

DELAY=1200 # in seconds


START=`date +%s`
LASTCOUNT=-1

# Force a track change at the beginning
echo "TITLE=BEGINNING";
echo "ARTIST=BEGINNING";
echo "."
sleep 1

while true ; do
        NOW=`date +%s`
        COUNT=$(((NOW-START)/$DELAY))
        if [[ $COUNT -ne $LASTCOUNT ]] ; then
                DATESTR=`date +%Y-%m-%d-%H-%M-%S`
        echo "ARTIST=$1";
            echo "TITLE=$DATESTR";
            echo "."
            LASTCOUNT=$COUNT
        fi
        sleep 1
done

The following script is “ripstream” :

#!/bin/sh

TRACKINFO=~/bin/ripstream-fake-trackinfo

cd ~/Desktop/Downloads/Radio || exit 1

streamripper $1 -D "%S-%d" -E "$TRACKINFO $2"

And here is how to call it :

ripstream URL Name

Keywords : record mp3 stream fixed length internet radio

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s