Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- # ecaedl.pl
- # script to take an mplayer created edl file
- # and the corresponding audio file and write
- # a series of ecasound ewf files to match
- # mplayer's edl file and then play them in
- # sequence with ecaplayer
- use strict;
- use Getopt::Long;
- use File::Basename;
- my ($help, $edl, $audfile, $result, $line, @lines, @parts, $numfiles, $oom, $efw, $efwo, $outfile, $name, $dir, $ext, @args);
- sub usage
- {
- print "Unknown option: @_\n" if ( @_ );
- print "usage: program [--edl edlfilename ] [--audfile audfilename] [--help|-h|-?]\n";
- exit;
- }
- usage() if ( ! GetOptions('help|h|?' => \$help, 'edl=s' => \$edl, 'audfile=s' => \$audfile) or defined $help or ! defined $edl or ! defined $audfile);
- print "$edl\n";
- print "$audfile\n";
- ($name,$dir,$ext) = fileparse($edl,'\..*');
- print "dir is $dir, name is $name, extension is $ext\n";
- open(EDLF, $edl);
- @lines = <EDLF>;
- close(EDLF);
- $numfiles = scalar @lines;
- $oom = length($numfiles);
- print "The number of files is $numfiles, order of magnitude $oom\n";
- $efw = 1;
- $efwo = substr("00000000$efw",-$oom);
- print "$efwo\n";
- for $line (@lines) {
- @parts = split(/ /, $line);
- $outfile = $name.$efwo."."."ewf";
- print "Outfile = $outfile\n";
- open(EDWF, ">$outfile");
- print EDWF "source = $audfile\n";
- print EDWF "start-position = $parts[0]\n";
- print EDWF "length = $parts[1]\n";
- close(EDWF);
- $efw = $efw + 1;
- print "efw is now $efw\n";
- $efwo = substr("00000000$efw",-$oom);
- print "$efwo\n";
- system("ecaplay $outfile");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement