]> git.donarmstrong.com Git - bin.git/blobdiff - scan_stuff
fix ambiguous redirect
[bin.git] / scan_stuff
index b556d962c65cb5220ad39872c97e51af4df8adff..1b34df9e045735d323aa9493b5d205718101a80d 100755 (executable)
@@ -21,6 +21,9 @@ scan_stuff - scans papers
 scan_stuff [options]
 
  Options:
+   --simplex single sided
+   --duplex double sided (Default)
+   --mode Scanning mode (Color,Gray,Lineart)
    --debug, -d debugging level (Default 0)
    --help, -h display this help
    --man, -m display manual
@@ -29,6 +32,19 @@ scan_stuff [options]
 
 =over
 
+=item B<--simplex>
+
+Single sided documents
+
+=item B<--duplex>
+
+Double sided documents (default)
+
+=item B<--mode>
+
+Scanning mode; passed directly to scanimage. Useful options are
+C<Gray> (Default), C<Color>, and C<Lineart>.
+
 =item B<--debug, -d>
 
 Debug verbosity. (Default 0)
@@ -45,7 +61,9 @@ Display this manual.
 
 =head1 EXAMPLES
 
-scan_stuff
+    scan_stuff; # repeat as necessary
+    scantailor-cli -l 1 --content-detection=cautious *.tif -o out;
+    make_djvu
 
 =cut
 
@@ -56,9 +74,13 @@ my %options = (device          => 'fujitsu',
                debug           => 0,
                help            => 0,
                man             => 0,
+               mode            => 'Gray'
               );
 
 GetOptions(\%options,
+           'duplex!',
+           'simplex!',
+           'mode=s',
            'debug|d+','help|h|?','man|m');
 
 pod2usage() if $options{help};
@@ -67,13 +89,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,8 +122,8 @@ find(sub { return if /^\./;
 $last_num++;
 
 exec('scanimage','-d',$options{device},
-     '--source','ADF Duplex','--mode','Gray','--format','tiff',
-     '--batch','out_'.sprintf('%03d',$lastnum).'_%03d.tif');
+     '--source',$use_duplex?'ADF Duplex':'ADF Front','--mode',$options{mode},'--format','tiff',
+     '--batch=out_'.sprintf('%03d',$last_num).'_%03d.tif');
 
 __END__