Rumel

Handbrake Script v0.1

Apr 22nd, 2011
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.80 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. #Designed by Dalton Stacey Dick
  4. #Version 0.1
  5.  
  6. #requires Cygwin to be installed
  7. #requires Cygwin programs to be in PATH
  8. #handbrake is also installed in PATH
  9.  
  10. @input = `ls "/cygdrive/l/Handbrake/Input"`;
  11. @fileFormats = qw/ .mpg .mkv .avi .wmv .mp4 .flv /;
  12.  
  13. print @input;
  14.  
  15. foreach $file (@input){
  16.     foreach $format (@fileFormats){
  17.         if($file =~ m/.$format/i){
  18.             chomp($file);
  19.             $number = length($file);
  20.             $number = $number - 5;
  21.             $checkFile = substr($file, 0, -4);
  22.             $finishedFile = $checkFile.".m4v";
  23.             system("ls "."\"L:\\Handbrake\\Output\\");
  24.             $string = "L:\\Handbrake\\Output\\".$finishedFile;
  25.             unless (-e $string){
  26.                 system("handbrakeCLI -i \"L:\\Handbrake\\Input\\$checkFile$format\" -o \"L:\\Handbrake\\Output\\".$checkFile.".m4v\" --preset iPod");
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment