]> git.donarmstrong.com Git - bin.git/commitdiff
add scan stuff
authorDon Armstrong <don@donarmstrong.com>
Sat, 13 Sep 2014 00:42:49 +0000 (17:42 -0700)
committerDon Armstrong <don@donarmstrong.com>
Sat, 13 Sep 2014 00:42:49 +0000 (17:42 -0700)
scan_stuff [new file with mode: 0755]

diff --git a/scan_stuff b/scan_stuff
new file mode 100755 (executable)
index 0000000..b556d96
--- /dev/null
@@ -0,0 +1,102 @@
+#!/usr/bin/perl
+# scan_stuff scans papers
+# and is released under the terms of the GNU GPL version 3, or any
+# later version, at your option. See the file README and COPYING for
+# more information.
+# Copyright 2014 by Don Armstrong <don@donarmstrong.com>.
+
+
+use warnings;
+use strict;
+
+use Getopt::Long;
+use Pod::Usage;
+
+=head1 NAME
+
+scan_stuff - scans papers
+
+=head1 SYNOPSIS
+
+scan_stuff [options]
+
+ Options:
+   --debug, -d debugging level (Default 0)
+   --help, -h display this help
+   --man, -m display manual
+
+=head1 OPTIONS
+
+=over
+
+=item B<--debug, -d>
+
+Debug verbosity. (Default 0)
+
+=item B<--help, -h>
+
+Display brief usage information.
+
+=item B<--man, -m>
+
+Display this manual.
+
+=back
+
+=head1 EXAMPLES
+
+scan_stuff
+
+=cut
+
+
+use vars qw($DEBUG);
+
+my %options = (device          => 'fujitsu',
+               debug           => 0,
+               help            => 0,
+               man             => 0,
+              );
+
+GetOptions(\%options,
+           'debug|d+','help|h|?','man|m');
+
+pod2usage() if $options{help};
+pod2usage({verbose=>2}) if $options{man};
+
+$DEBUG = $options{debug};
+
+my @USAGE_ERRORS;
+# if (1) {
+#     push @USAGE_ERRORS,"You must pass something";
+# }
+
+pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
+
+
+use File::Find;
+
+if (@ARGV) {
+    chdir($ARGV[0]);
+}
+
+my $last_num = 0;
+find(sub { return if /^\./;
+           $File::Find::prune = 1 if -d $_;
+           if (/out_(\d+)_/) {
+               $last_num = $1 if $1 > $last_num;
+           }
+       }
+     ,'.');
+
+$last_num++;
+
+exec('scanimage','-d',$options{device},
+     '--source','ADF Duplex','--mode','Gray','--format','tiff',
+     '--batch','out_'.sprintf('%03d',$lastnum).'_%03d.tif');
+
+__END__
+
+
+
+