The idea is pretty simple: Use ffmpeg to save the stream online, copy it to your podcast server and enjoy. Let's work to put everything together:
First thing you're gonna need is some scripts. The first one captures the stream of audio and dumps into a ts file:
otubo@deathstar /opt/ $ cat capture_stream.sh
#/bin/bash
TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S");
/usr/bin/ffmpeg -i URL
Next, you're going to need a script to encode the transport stream into mp3:
otubo@deathstar /opt/ $ cat encode_stream.sh
#/bin/bash
LAST_TS_FILE="$(ls -1t /opt/|grep ts|head -1)"
NEW_MP3_FILE="$(echo $LAST_TS_FILE|sed -e 's/ts/mp3/g')"
LAST_TS_FILE="/opt/${LAST_TS_FILE}"
NEW_MP3_FILE="/var/www/html/media/${NEW_MP3_FILE}"
/usr/bin/ffmpeg -i "${LAST_TS_FILE}" -acodec mp3 -write_xing 0 "${NEW_MP3_FILE}"
/usr/bin/id3 -t "$(date)" "${NEW_MP3_FILE}"
/usr/bin/id3 -a "News" "${NEW_MP3_FILE}"
wget -O- http://GENERATOR SERVER ADDR/html/pg-cron.php?key=YOUR KEY >/dev/null 2>&1
rm "${LAST_TS_FILE}"
Little gotcha: I had this issue with the iPhone podcast app, according to this ticket, adding the option -write_xing 0 solves the problem.
Note that in the last script, there's the "Podcast Generator" server. That's a really neat and simple to use podcast server made with php5. You can download it here: http://podcastgen.sourceforge.net/. The instructions to install and configure are very easy, and as they say: Newbie-proof.
Let's dig down a little bit on the last script: First you run ffmpeg to convert the transport stream into mp3, then you set the title id3 tag for the title of this podcast "episode", than set the artist id3 tag for the description. After that you call wget to reload your podcast library and update the RSS. And it's done!
Now let's put everything on the crontab:
30 10 * * * /opt/capture_stream.sh
2 12 * * * killall -9 ffmpeg
3 12 * * * /opt/encode_stream.sh