/* 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 int main() { int pid; pid = fork(); 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); if (pid < 0) { /* error occurred */ fprintf(stderr, "Fork failed!\n"); exit(-1); } else if (pid==0) { /* child process */ execlp("mplayer", "mplayer", "-playlist", url, "-ao", "pcm:file=stream.tmp.wav", NULL); } else { /* parent process */ if (pid < 0) { /* error occurred */ fprintf(stderr, "Fork failed!\n"); exit(-1); } else if (pid==0) { /* child process */ execlp("lame", "lame", "stream.tmp.wav", file, NULL); } else { /* parent process */ execlp("rm", "rm", "stream.tmp.wav", NULL); } execlp("rm", "rm", "stream.tmp.wav", NULL); } return 0; }