CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Automate download of .RAM files - buffer with Mplayer


New User

Sep 17, 2010, 12:43 AM

Post #1 of 1 (969 views)
Automate download of .RAM files - buffer with Mplayer Can't Post

the problem is that a website only let's me download a ".RAM" file....which is really just a text file which has the address of a ".RM" (real media) file held on a RSTP server...sadly Wget can't handle the RSTP server...which means that i had to be creative and convince mplayer to stream the music into a buffer and then output it as a file

Here is what i was trying to do

* My code accepts a single argument which is the location of a folder full of these .ram files...
* it then opens this directory and begins a loop where it cycles through the .ram files and:
o Opens the ram files text and reads the remote file location
o Saves that location as the variable $remote (as in remote location)
o it closes that particular .ram file
o removes the extension from the local files filename and tells the variable it should now be a .wav
o creates a new .wav file to dump the stream into
o creates and argument string named $String which tells mplayer to drop the audio in the new .wav file and from the remote stream
o has the system run $String
o lame and rm do something to encode the file
* loop with the next file

Thank you so much for your help! I am brand new and getting it to work this well took me 4 hours

Here is my code so far

#!/usr/bin/perl -w 

$dirname = $ARGV[0];
opendir(DIR, $dirname) or die "can't opendir $dirname: $!";
while (defined($file = readdir(DIR))) {
Open(DATA, $dirname/$file);
$remote = "$_";
#$remote = System(cat $dirname/$file);
$file=~ s/\..*//;
$local = $dirname/$file;
mkfifo $local;
$String = "mplayer mplayer -ao pcm:file=" + $local + $remote;
lame $local;
rm $local;


Attachments: Screenshot-root@Inspiron9400: -home-marconnet.png (215 KB)


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives