SHARE
TWEET

ecaedl.pl

a guest May 23rd, 2010 288 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl -w
  2.  
  3. # ecaedl.pl
  4. # script to take an mplayer created edl file
  5. # and the corresponding audio file and write
  6. # a series of ecasound ewf files to match
  7. # mplayer's edl file and then play them in
  8. # sequence with ecaplayer
  9.  
  10. use strict;
  11.  
  12. use Getopt::Long;
  13. use File::Basename;
  14.  
  15.  
  16. my ($help, $edl, $audfile, $result, $line, @lines, @parts, $numfiles, $oom, $efw, $efwo, $outfile, $name, $dir, $ext, @args);
  17.  
  18. sub usage
  19. {
  20.   print "Unknown option: @_\n" if ( @_ );
  21.   print "usage: program [--edl edlfilename ] [--audfile audfilename] [--help|-h|-?]\n";
  22.   exit;
  23. }
  24.  
  25.  
  26. usage() if ( ! GetOptions('help|h|?' => \$help, 'edl=s' => \$edl, 'audfile=s' => \$audfile) or defined $help or ! defined $edl or ! defined $audfile);
  27.  
  28. print "$edl\n";
  29. print "$audfile\n";
  30. ($name,$dir,$ext) = fileparse($edl,'\..*');
  31. print "dir is $dir, name is $name, extension is $ext\n";
  32.  
  33.  
  34.  
  35. open(EDLF, $edl);
  36. @lines = <EDLF>;
  37. close(EDLF);
  38. $numfiles = scalar @lines;
  39. $oom = length($numfiles);
  40. print "The number of files is $numfiles, order of magnitude $oom\n";
  41.  
  42. $efw = 1;
  43. $efwo = substr("00000000$efw",-$oom);
  44. print "$efwo\n";
  45.  
  46. for $line (@lines) {
  47.    @parts = split(/ /, $line);
  48.    $outfile = $name.$efwo."."."ewf";
  49.    print "Outfile = $outfile\n";
  50.    open(EDWF, ">$outfile");
  51.    print EDWF "source = $audfile\n";
  52.    print EDWF "start-position = $parts[0]\n";
  53.    print EDWF "length = $parts[1]\n";
  54.    close(EDWF);
  55.    $efw = $efw + 1;
  56.    print "efw is now $efw\n";
  57.    $efwo = substr("00000000$efw",-$oom);
  58.    print "$efwo\n";
  59.    system("ecaplay $outfile");
  60. }
RAW Paste Data
Challenge yourself this year...
Learn something new in 2017
Top