diff options
Diffstat (limited to 'util/splitter')
-rwxr-xr-x | util/splitter | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/util/splitter b/util/splitter new file mode 100755 index 0000000..0373669 --- /dev/null +++ b/util/splitter @@ -0,0 +1,30 @@ +#!/usr/bin/perl +my $target; +my $md5_hash; +my $png; +my $count = 0; + + +while (<>){ + if (/(.*),,,vas,,,(.*),,,vas,,,(.*)/) { + if($target){ + mkdir "images-man/$target" unless -d "images-man/$target"; + open(my $fh, '>', "images-man/$target/$target-$md5_hash.png") or die "could not write"; + print $fh $png; + close $fh; + } + $count++; + $target = $1; + $md5_hash = $2; + $png = $3."\n"; + } else { + $png.=$_; + } +} + +mkdir "images-man/$target" unless -d "images-man/$target"; +open(my $fh, '>', "images-man/$target/$target-$md5_hash.png") or die; +print $fh $png; +close $fh; + +print($count, " images written\n"); |