]> git.donarmstrong.com Git - bin.git/commitdiff
make scan stuff use simplex if specified and have more options in general
authorDon Armstrong <don@donarmstrong.com>
Fri, 26 Sep 2014 22:53:21 +0000 (15:53 -0700)
committerDon Armstrong <don@donarmstrong.com>
Fri, 26 Sep 2014 22:53:21 +0000 (15:53 -0700)
scan_stuff

index 8b08761cbcad3494c05c001750c9127752f8f224..484ea31e3e7e0298e09f1686cb475147d1194790 100755 (executable)
@@ -56,9 +56,12 @@ my %options = (device          => 'fujitsu',
                debug           => 0,
                help            => 0,
                man             => 0,
+               mode            => 'Gray'
               );
 
 GetOptions(\%options,
+           'duplex!',
+           'simplex!',
            'debug|d+','help|h|?','man|m');
 
 pod2usage() if $options{help};
@@ -67,13 +70,21 @@ pod2usage({verbose=>2}) if $options{man};
 $DEBUG = $options{debug};
 
 my @USAGE_ERRORS;
-# if (1) {
-#     push @USAGE_ERRORS,"You must pass something";
-# }
+my $use_duplex = 1;
+if (exists $options{duplex} and exists $options{simplex} and
+    not ($options{duplex} xor $options{simplex})) {
+    push @USAGE_ERRORS,"Conflicting --duplex and --simplex options given";
+}
 
 pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
 
 
+if ((exists $options{duplex} and not $options{duplex}) or
+    (exists $options{simplex} and $options{simplex})) {
+    $use_duplex = 0;
+}
+
+
 use File::Find;
 
 if (@ARGV) {
@@ -92,7 +103,7 @@ find(sub { return if /^\./;
 $last_num++;
 
 exec('scanimage','-d',$options{device},
-     '--source','ADF Duplex','--mode','Gray','--format','tiff',
+     '--source',$use_duplex?'ADF Duplex':'ADF Front','--mode',$options{mode},'--format','tiff',
      '--batch=out_'.sprintf('%03d',$last_num).'_%03d.tif');
 
 __END__