/* getstream-ra / Auldor 2007 (longbow.tar.cc) * * A simple app to download RealAudio streams and convert them to MP3s * Based on commands from http://stommel.tamu.edu/~baum/linux-music.html */ #include #include #include main() { char *url; char *file; printf("Stream URL (must start with http:// and end with .ram)\n> "); scanf("%s",url); printf("Save stream as... (must end with .mp3)\n> "); scanf("%s",file); spawn(const char *arg) { static char *shell = NULL; if(!shell && !(shell = getenv("SHELL"))) shell = "/bin/sh"; if(!arg) return; /* The double-fork construct avoids zombie processes and keeps the code * clean from stupid signal handlers. */ if(fork() == 0) { if(fork() == 0) { execlp("mplayer", "mplayer", "-playlist", url, "-ao", "pcm:file=stream.tmp.wav", NULL); } exit(0); } wait(0); } /* execlp("lame", "lame", "stream.tmp.wav", file, NULL); * execlp("rm", "rm", "stream.tmp.wav", NULL); */ return 0; }