| 304 | | if ($conf->{focr_global_timeout}) { |
|---|
| 305 | | @stdout_data = qx($conf->{focr_bin_giftext} $file); |
|---|
| 306 | | } else { |
|---|
| 307 | | my $t = get_timeout(); |
|---|
| 308 | | my $retcode = $t->run_and_catch(sub { |
|---|
| 309 | | @stdout_data = qx($conf->{focr_bin_giftext} $file); |
|---|
| 310 | | }); |
|---|
| 311 | | if ($retcode) { |
|---|
| 312 | | chomp $retcode; |
|---|
| 313 | | debuglog("$conf->{focr_bin_giftext} Timed out [$retcode], skipping..."); |
|---|
| 314 | | ++$imgerr if $conf->{focr_keep_bad_images}>0; next; |
|---|
| 315 | | } |
|---|
| 316 | | } |
|---|
| | 306 | my ($retcode, @stdout_data) = save_execute("$conf->{focr_bin_giftext} $file", ">$imgdir/giftext.info", ">>$imgdir/giftext.err", 1); |
|---|
| | 307 | |
|---|
| | 308 | if ($retcode) { |
|---|
| | 309 | chomp $retcode; |
|---|
| | 310 | debuglog("$conf->{focr_bin_giftext} Timed out [$retcode], skipping..."); |
|---|
| | 311 | ++$imgerr if $conf->{focr_keep_bad_images}>0; next; |
|---|
| | 312 | } |
|---|
| | 313 | |
|---|
| 334 | | if ($conf->{focr_global_timeout}) { |
|---|
| 335 | | qx($conf->{focr_bin_giffix} $file >$tfile 2>>$efile); |
|---|
| 336 | | } else { |
|---|
| 337 | | my $t = get_timeout(); |
|---|
| 338 | | my $retcode = $t->run_and_catch(sub { |
|---|
| 339 | | qx($conf->{focr_bin_giffix} $file >$tfile 2>>$efile); |
|---|
| 340 | | }); |
|---|
| 341 | | if ($retcode) { |
|---|
| 342 | | chomp $retcode; |
|---|
| 343 | | debuglog("$conf->{focr_bin_giffix}: Timed out [$retcode], skipping..."); |
|---|
| 344 | | printf RAWERR "?? Timed out > $retcode\n" if ($haserr>0); |
|---|
| 345 | | ++$imgerr if $conf->{focr_keep_bad_images}>0; next; |
|---|
| 346 | | } |
|---|
| 347 | | } |
|---|
| | 331 | $retcode = save_execute("$conf->{focr_bin_giffix} $file", ">$tfile", ">>$efile"); |
|---|
| | 332 | |
|---|
| | 333 | if ($retcode) { |
|---|
| | 334 | chomp $retcode; |
|---|
| | 335 | debuglog("$conf->{focr_bin_giffix}: Timed out [$retcode], skipping..."); |
|---|
| | 336 | printf RAWERR "?? Timed out > $retcode\n" if ($haserr>0); |
|---|
| | 337 | ++$imgerr if $conf->{focr_keep_bad_images}>0; next; |
|---|
| | 338 | } |
|---|
| | 339 | |
|---|
| 389 | | if ($conf->{focr_global_timeout}) { |
|---|
| 390 | | qx($conf->{focr_bin_gifinter} $cfile >$tfile 2>>$efile); |
|---|
| 391 | | } else { |
|---|
| 392 | | my $t = get_timeout(); |
|---|
| 393 | | my $retcode = $t->run_and_catch(sub{ |
|---|
| 394 | | qx($conf->{focr_bin_gifinter} $cfile >$tfile 2>>$efile); |
|---|
| 395 | | }); |
|---|
| 396 | | if ($retcode) { |
|---|
| 397 | | chomp $retcode; |
|---|
| 398 | | printf RAWERR "?? Timed out > $retcode\n" if ($haserr>0); |
|---|
| 399 | | debuglog("$conf->{focr_bin_gifinter}: Timed out [$retcode], skipping..."); |
|---|
| 400 | | ++$imgerr if $conf->{focr_keep_bad_images}>0; next; |
|---|
| 401 | | } |
|---|
| 402 | | } |
|---|
| 403 | | } |
|---|
| 404 | | |
|---|
| 405 | | printf RAWERR qq(## $conf->{focr_bin_giftopnm} $tfile >$pfile 2>>$efile\n) if ($haserr>0); |
|---|
| 406 | | if ($conf->{focr_global_timeout}) { |
|---|
| 407 | | qx($conf->{focr_bin_giftopnm} $tfile >$pfile 2>>$efile); |
|---|
| 408 | | } else { |
|---|
| 409 | | my $t = get_timeout(); |
|---|
| 410 | | my $retcode = $t->run_and_catch(sub { |
|---|
| 411 | | qx($conf->{focr_bin_giftopnm} $tfile >$pfile 2>>$efile); |
|---|
| 412 | | }); |
|---|
| | 381 | $retcode = save_execute("$conf->{focr_bin_gifinter} $cfile", ">$tfile", ">>$efile"); |
|---|
| | 382 | |
|---|
| 442 | | if ($conf->{focr_global_timeout}) { |
|---|
| 443 | | qx($conf->{focr_bin_jpegtopnm} $file >$pfile 2>>$efile); |
|---|
| 444 | | } else { |
|---|
| 445 | | my $t = get_timeout(); |
|---|
| 446 | | my $retcode = $t->run_and_catch(sub { |
|---|
| 447 | | qx($conf->{focr_bin_jpegtopnm} $file >$pfile 2>>$efile); |
|---|
| 448 | | }); |
|---|
| 449 | | if ($retcode) { |
|---|
| 450 | | chomp $retcode; |
|---|
| 451 | | printf RAWERR "?? Timed out > $retcode\n" if ($haserr>0); |
|---|
| 452 | | debuglog("$conf->{focr_bin_jpegtopnm}: Timed out [$retcode], skipping..."); |
|---|
| 453 | | ++$imgerr if $conf->{focr_keep_bad_images}>0; next; |
|---|
| 454 | | } |
|---|
| | 422 | $retcode = save_execute("$conf->{focr_bin_jpegtopnm} $file", ">$pfile", ">>$efile"); |
|---|
| | 423 | |
|---|
| | 424 | if ($retcode) { |
|---|
| | 425 | chomp $retcode; |
|---|
| | 426 | printf RAWERR "?? Timed out > $retcode\n" if ($haserr>0); |
|---|
| | 427 | debuglog("$conf->{focr_bin_jpegtopnm}: Timed out [$retcode], skipping..."); |
|---|
| | 428 | ++$imgerr if $conf->{focr_keep_bad_images}>0; next; |
|---|
| 477 | | if ($conf->{focr_global_timeout}) { |
|---|
| 478 | | qx($conf->{focr_bin_pngtopnm} $file >$pfile 2>>$efile); |
|---|
| 479 | | } else { |
|---|
| 480 | | my $t = get_timeout(); |
|---|
| 481 | | my $retcode = $t->run_and_catch(sub { |
|---|
| 482 | | qx($conf->{focr_bin_pngtopnm} $file >$pfile 2>>$efile); |
|---|
| 483 | | }); |
|---|
| 484 | | if ($retcode) { |
|---|
| 485 | | chomp $retcode; |
|---|
| 486 | | printf RAWERR "?? Timed out > $retcode\n" if ($haserr>0); |
|---|
| 487 | | debuglog("$conf->{focr_bin_pngtopnm}: Timed out [$retcode], skipping..."); |
|---|
| 488 | | ++$imgerr if $conf->{focr_keep_bad_images}>0; next; |
|---|
| 489 | | } |
|---|
| | 452 | $retcode = save_execute("$conf->{focr_bin_pngtopnm} $file", ">$pfile", ">>$efile"); |
|---|
| | 453 | |
|---|
| | 454 | if ($retcode) { |
|---|
| | 455 | chomp $retcode; |
|---|
| | 456 | printf RAWERR "?? Timed out > $retcode\n" if ($haserr>0); |
|---|
| | 457 | debuglog("$conf->{focr_bin_pngtopnm}: Timed out [$retcode], skipping..."); |
|---|
| | 458 | ++$imgerr if $conf->{focr_keep_bad_images}>0; next; |
|---|
| 512 | | if ($conf->{focr_global_timeout}) { |
|---|
| 513 | | qx($conf->{"focr_bin_bmptopnm"} $file >$pfile 2>>$efile); |
|---|
| 514 | | } else { |
|---|
| 515 | | my $t = get_timeout(); |
|---|
| 516 | | my $retcode = $t->run_and_catch(sub { |
|---|
| 517 | | qx($conf->{"focr_bin_bmptopnm"} $file >$pfile 2>>$efile); |
|---|
| 518 | | }); |
|---|
| 519 | | if ($retcode) { |
|---|
| 520 | | chomp $retcode; |
|---|
| 521 | | printf RAWERR "?? Timed out > $retcode\n" if ($haserr>0); |
|---|
| 522 | | debuglog("$conf->{focr_bin_bmptopnm}: Timed out [$retcode], skipping..."); |
|---|
| 523 | | ++$imgerr if $conf->{focr_keep_bad_images}>0; next; |
|---|
| 524 | | } |
|---|
| | 481 | |
|---|
| | 482 | $retcode = save_execute("$conf->{focr_bin_bmptopnm} $file", ">$pfile", ">>$efile"); |
|---|
| | 483 | if ($retcode) { |
|---|
| | 484 | chomp $retcode; |
|---|
| | 485 | printf RAWERR "?? Timed out > $retcode\n" if ($haserr>0); |
|---|
| | 486 | debuglog("$conf->{focr_bin_bmptopnm}: Timed out [$retcode], skipping..."); |
|---|
| | 487 | ++$imgerr if $conf->{focr_keep_bad_images}>0; next; |
|---|
| 548 | | if ($conf->{focr_global_timeout}) { |
|---|
| 549 | | qx($conf->{'focr_bin_tifftopnm'} $file >$pfile 2>>$efile); |
|---|
| 550 | | } else { |
|---|
| 551 | | my $t = get_timeout(); |
|---|
| 552 | | my $retcode = $t->run_and_catch(sub { |
|---|
| 553 | | qx($conf->{'focr_bin_tifftopnm'} $file >$pfile 2>>$efile); |
|---|
| 554 | | }); |
|---|
| 555 | | if ($retcode) { |
|---|
| 556 | | chomp $retcode; |
|---|
| 557 | | printf RAWERR "?? Timed out > $retcode\n" if ($haserr>0); |
|---|
| 558 | | debuglog("$conf->{focr_bin_tifftopnm}: Timed out [$retcode], skipping..."); |
|---|
| 559 | | ++$imgerr if $conf->{focr_keep_bad_images}>0; next; |
|---|
| 560 | | } |
|---|
| | 511 | $retcode = save_execute("$conf->{focr_bin_tifftopnm} $file", ">$pfile", ">>$efile"); |
|---|
| | 512 | |
|---|
| | 513 | if ($retcode) { |
|---|
| | 514 | chomp $retcode; |
|---|
| | 515 | printf RAWERR "?? Timed out > $retcode\n" if ($haserr>0); |
|---|
| | 516 | debuglog("$conf->{focr_bin_tifftopnm}: Timed out [$retcode], skipping..."); |
|---|
| | 517 | ++$imgerr if $conf->{focr_keep_bad_images}>0; next; |
|---|
| 613 | | if ($conf->{focr_global_timeout}) { |
|---|
| 614 | | @ocrdata = qx($scan 2>>$efile); |
|---|
| 615 | | } else { |
|---|
| 616 | | my $t = get_timeout(); |
|---|
| 617 | | my $retcode = $t->run_and_catch(sub { |
|---|
| 618 | | @ocrdata = qx($scan 2>>$efile); |
|---|
| 619 | | }); |
|---|
| 620 | | if ($retcode) { |
|---|
| 621 | | chomp $retcode; |
|---|
| 622 | | open ERR,$efile; |
|---|
| 623 | | my @stderr = <ERR>; |
|---|
| 624 | | close ERR; |
|---|
| 625 | | my $errstr = join( '', $retcode,@stderr ); |
|---|
| 626 | | debuglog($errstr); |
|---|
| 627 | | printf RAWERR qq($errstr\n) if ($haserr>0); |
|---|
| 628 | | debuglog("Skipping scanset \"$scanset\" because of errors, trying next..."); |
|---|
| 629 | | next; |
|---|
| 630 | | } |
|---|
| 631 | | } |
|---|
| | 570 | |
|---|
| | 571 | ($retcode, @ocrdata) = save_execute("$scan", ">$imgdir/ocr.temp", ">>$efile"); |
|---|
| | 572 | if ($retcode) { |
|---|
| | 573 | chomp $retcode; |
|---|
| | 574 | open ERR,$efile; |
|---|
| | 575 | my @stderr = <ERR>; |
|---|
| | 576 | close ERR; |
|---|
| | 577 | my $errstr = join( '', $retcode,@stderr ); |
|---|
| | 578 | debuglog($errstr); |
|---|
| | 579 | printf RAWERR qq($errstr\n) if ($haserr>0); |
|---|
| | 580 | debuglog("Skipping scanset \"$scanset\" because of errors, trying next..."); |
|---|
| | 581 | next; |
|---|
| | 582 | } |
|---|
| | 583 | |
|---|