One of my favorite radio station switched from shortwave to internet , and is now switching from live broadcasting to podcast. They call it a reforming to catch up with the age, but I still prefer listening the traditional way, tuning in to my favorite programs on a radio receiver, or listen online through live streams. I hate podcasts!
So I set out to transcode their podcasts into a streaming radio on my server, and listen when I’m at my computer, just like tuning to a live program. To achieve this, three parts are needed:
- Download podcasts from the RSS source
- Encode the audio files into live streams
- Publish it on a Icecast or Shoutcast sever
My server is runing CentOS 5.4. For downloading podcasts, I find a nice program called Podcatcher on sourceforge, it can do this job perfectly. Download it at http://podcatcher.rubyforge.org/ and please read the READEME file for usage. I created a cron job with Podcatcher using the following macro.
/me/podcast/bin/podcatcher --cachedir /me/audio/podcast/ -d /me/podcast/bin/ --size 2048 -S chron http://www.1cvc.com/audio/feed
Podcasts will be updated every 30 minutes, all files will be stored locally in folder /me/audio/podcast/. The cache dir is set to up to 2GB, old files will be deleted when folder overflowed.
Then encode the mp3 files into live streams. There are many free software available for Linux, I choose ices0.4 from icecast.org, most compliant with Icecast streaming server which I will use in the next step, you may still use other softwares such as ezstream and oddcast. Follow the example to create a config file, documents are available at http://www.icecast.org/docs/ices-2.0.0/config.html. Note: to stream in a fixed bitrate, you must enable the “reencode” option.
Playlist can be generated using following line:
find /me/audio/podcast/ -type f -name "*.mp3" -mtime -1 > /me/ices/playlist.txt
This script will find all mp3 files created within 24 hours in the folder and export their paths to playlist.txt, one file per line. Add this script as a cron job, then the playlist will get updated automatically, but unfortunately, ices won’t notice the changes, and there’s no parameter to reload configuration, so you have to kill the process and reopen it. Together with the script above, I put the following scripts to a cron job, running once a day at midnight:
find me/audio/podcast -type f -name "*.mp3" -mtime -1 > /me/ices/playlist.txt
killall ices
ices -c /me/ices/ices.conf
Now, time to wake up our Icecast server. I assume you have installed it without any problem, there are many detailed documents on how to config the Icecast server if you face any: http://www.icecast.org/docs.php. Just to mention, with Icecast, configuration can be reloaded by sending a HUP signal to it, like:
killall -s HUP icecast
Enjoy it!
http://stream.judesimon.com/sea.m3u