Created
March 12, 2021 14:26
-
-
Save smooker/0f127dd3d2e7a23a3bad0e14befb5cb3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use File::Find qw(finddepth); | |
use File::Basename; | |
use sigtrap qw/handler signal_handler normal-signals/; | |
#perl -e 'foreach (keys %SIG) { print "$_\n" }' | |
$SIG{INT} = \&signal_handler; | |
$SIG{TERM} = \&signal_handler; | |
sub signal_handler { | |
die "Caught a signal $!"; | |
} | |
sub handle_error { | |
# $dbh->rollback(); | |
my $error = shift; | |
print "An error occurred in the script\n"; | |
print "Message: $error\n"; | |
die ("olele"); | |
return 1; | |
} | |
my @files; | |
finddepth(sub { | |
return if($_ eq '.' || $_ eq '..'); | |
-f and -r and push @files, $File::Find::name; | |
}, './'); | |
#%03d za scan.sh | |
foreach my $file (sort(@files)) { | |
my $fn = basename($file); | |
my $dn = dirname($file); | |
#out_09.tif | |
if ($fn =~ m/(.+)\.webm$/) { | |
print $fn."\n"; | |
my $fnwoext = $1; | |
# system("convert $file -crop 250x30+170+175 -rotate -90 -color-threshold 'sRGB(50,0,0)-sRGB(253,152,80)' -negate $file.png"); | |
# system("convert $file -crop 250x30+170+175 -rotate -90 -color-threshold 'sRGB(253,152,80)-sRGB(50,0,0)' $file.png"); | |
# system("convert $file -color-threshold 'sRGB(10,0,0)-sRGB(203,152,80)' -negate $file.2.png"); | |
# system("convert $file -crop 250x30+170+175 -rotate -90 $file.png"); | |
# system("tesseract $file.png stdout -l eng batch.nochop digits"); | |
#ffmpeg -i Amon\ Amarth\ -\ Raven\'s\ Flight-H24S0nym-pE.webm Amon\ Amarth\ -\ Raven\'s\ Flight-H24S0nym-pE.wav | |
my @args = ("ffmpeg", "-i", $fn, "-y", $fnwoext.".wav"); | |
system(@args) == 0 | |
or die "system @args failed: $?"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment