RockSox
Posts: 3
Joined: Wed May 15, 2013 7:12 pm

Internet Radio Stream Schedule Recorder

Wed May 15, 2013 7:27 pm

Hello,
I'm really new to the Pi, and have basically no experience in Linux or coding. Yes sorry in advance.

I'm trying to setup my Pi to replace a computer which is doing only one function at the moment. I'm curious which is the best way to setup my Pi to have scheduled records of Internet radio streams. Currently have a have a mixture of recordings based on the TuneIn radio schedule, and a manually programmed time. At the end the records they're rendered out as MP3. I'm not interested in ripping individual tracks, just record a whole show and render it.

I have Whezzy up and running, and if there is a GUI or app for the stream recorder the better as I'm not too experienced in command line just yet. Any help to point me in the right direction would be much apperieated.

Thanks

123pame
Posts: 1
Joined: Tue May 21, 2013 10:52 pm

Re: Internet Radio Stream Schedule Recorder

Wed May 22, 2013 12:10 am

Hi RockSox,

I've been doing what you want to achieve (sans any GUI) for the last couple of months or so. I'm using Arch Linux but the basic principles should remain the same, so I'll try to outline the procedure below and you can take it on from there and adapt it to the particulars of Debian Wheezy if you have to.

Basically, all you'll need is:
  • streamripper (http://sourceforge.net/projects/streamripper/)
    (supports mp3/aac Shoutcast/Icecast streams, and ogg streams)
  • the URL of the Internet Radio stream you want to rip/record
  • crontab entries to automate/schedule the recordings
Hopefully Debian Wheezy has the streamripper package in their repositories, so the first step is to download and install it with:

Code: Select all

apt-get install streamripper
If for some reason they don't have it, you'll have to download the source tarball for the latest version (1.64.6) from SourceForge, compile from source and install it manually. I appreciate you have minimal experience with Linux/coding so I'll help you if you have to follow that route.

As for the stream URL, I've found that if there is a "Click here to listen" button on the Radio station's website then most of the time you can locate the URL by just looking at the HTML source of the page in question. Or, if they offer a .pls/.m3u playlist file for you to download, just peer inside that one with a text editor and look for the URL in there.

Once you've located the URL, as a regular (non-root) user create a file that contains the following:

Code: Select all

streamripper http://www.radiostationx.com:8000 -a -A -d /rips/stationx/showy -l 3600
The command-line parameters above are asking streamripper to rip to a single file without writing individual tracks (-a -A), place the files in the directory /rips/stationx/showy, and to record 3600 seconds (1 hour) of program (-l 3600).

Name your file something like "stationx_showy.sh", and make sure you have execute permissions on it by issuing:

Code: Select all

chmod u+x stationx_showy.sh
The next (and final) step is to create so-called 'cron entries' (the equivalent of Windows' "Scheduled Tasks") so that you can control when a particular stream/show should be recorded. Issue the following command to start editing your own crontab:

Code: Select all

crontab -e
This should take you into a text editor where you'll be able to add one or more entries for the show(s) you wish to record. An example of such an entry is as follows:

Code: Select all

30 15 * * * /home/username/stationx_showy.sh >> /home/username/stationx_showy.sh.log
The entry above will result in the /home/username/stationx_showy.sh script being executed every day (* * *) at 15:30 (30 15) and any output from the script being appended to /home/username/stationx_showy.sh.log.

The syntax of crontab entries is as follows (issue the command man 5 crontab for more info):

Code: Select all

minute hour day-of-month month day-of-week script-to-execute
So, if you wanted to record a show that airs between 10:00-10:45 during the weekend, you would do it as follows:

Code: Select all

00 10 * * sat-sun /home/username/weekend_show.sh >> /home/username/weekend_show.sh.log
and in your weekend_show.sh you would have to specify a duration of 45 minutes like so:

Code: Select all

streamripper http://www.radioy.com:8000 -a -A -d /rips/stationy/weekends -l 2700
You can create as many shell scripts as you wish for each show you want to record (just remember to adjust the desired recording length in seconds) and pair them with the appropriate crontab entries to automate the recording of your favourite shows.

You should also be able to have more than one radio stream being recorded at the same time, provided you adjust your shell scripts accordingly to have them output the files in separate directories.

I hope the above helps, let me know if you need any further help/clarifications (and sorry for the long write-up!)

Regards,
123pame

RockSox
Posts: 3
Joined: Wed May 15, 2013 7:12 pm

Re: Internet Radio Stream Schedule Recorder

Wed May 22, 2013 8:15 am

Wow :shock:
Thank you so much for your help, I'll give it a go.

mro
Posts: 5
Joined: Mon Jul 01, 2013 7:24 pm

Re: Internet Radio Stream Schedule Recorder

Mon Jul 01, 2013 10:09 pm

Hi RockSox,
maybe this goes into the same direction: https://github.com/mro/radio-pi

You will need to write a program scraper though to get a machine-readable schedule.

Which station is it you want to record?

Signs
Posts: 54
Joined: Sun Nov 13, 2011 8:58 pm

Re: Internet Radio Stream Schedule Recorder

Fri Nov 08, 2013 12:29 am

123pame I am wondering if you are someone else could do this for me? I would be willing to pay for it by Paypal.
My situation may be a little different, than just recording. What I would like to do is not only record but have the stream playing at the same time. I have purchased a FM radio transmitter for my house to do this. I have 2 wifi radios, however, the cost is more for a wifi radio than being able to stream everything to my own FM channel, and I can listen to it all over the house without having to attach an adapter to each radio.
At present I am able to do it with a plugin to Firefox (My Weekly Browsing Schedule) and a program by the name of "Total Recorder". These both operate in XP in which I could keep on the fit-pc2, but I would rather have something headless to do it. (And less expensive) Plus I would be able to run the Pi off of low power, (I do this with the fit-pc2 now), along with the transmitter. I live in Virginia in the United States. I would prefer the SD card snail mailed to me, rather than downloading the files. If anyone wants to do it, reply to this post, and we will get together on it. :)

Return to “Graphics, sound and multimedia”