realdump: dump RealPlayer stream to file

The following function/script will dump the data from a RealPlayer stream to disk as a WAV file. Put it into your ~/.profile, or make a shell script out of it.

 1    function realdump
 2    {
 3        if test -f $1 ; then
 4            realdump `cat $1`
 5        else
 6            export temp=${1/#*\//}
 7            export filename=${temp/.*/.wav}
 8            ~/bin/mplayer -cache 128 -vc dummy -vo null -ao pcm -aofile $filename $1
 9        fi
10        if test $_# -gt 1 ; then
11            shift
12            realdump $*
13        fi
14        
15    }

It creates a file with the same basename (the filename minus the extension), with an extension of .wav; there is no checking to see if the file exists already, and old file will be overwritten. The argument to realdump can be either the URLs of the streams, or the name of a file with the URLs of the streams in it. It should handle files with multiple entries, so you can concatenate a series of .ram files, and it should download each of them in turn. Ensure they have different filenames, not just different directories!