52 lines
2.1 KiB
Diff
52 lines
2.1 KiB
Diff
--- lib/Gscan2pdf/Tesseract.pm.orig 2020-09-21 18:00:10.368568923 +0200
|
|
+++ lib/Gscan2pdf/Tesseract.pm 2020-09-21 18:02:36.797305878 +0200
|
|
@@ -52,25 +52,25 @@
|
|
return $installed if $setup;
|
|
|
|
( undef, my $exe ) =
|
|
- Gscan2pdf::Document::exec_command( [ 'which', 'tesseract' ] );
|
|
+ Gscan2pdf::Document::exec_command( [ 'which', 'tesseract-ocr' ] );
|
|
return if ( not defined $exe or $exe eq $EMPTY );
|
|
$installed = 1;
|
|
|
|
# Only support 3.02.01 or better, so that
|
|
# we can use --list-langs and not bother with tessdata
|
|
( undef, my $out, my $err ) =
|
|
- Gscan2pdf::Document::exec_command( [ 'tesseract', '-v' ] );
|
|
- if ( $err =~ /^tesseract[ ]([\d.]+)/xsm ) {
|
|
+ Gscan2pdf::Document::exec_command( [ 'tesseract-ocr', '-v' ] );
|
|
+ if ( $err =~ /^tesseract-ocr[ ]([\d.]+)/xsm ) {
|
|
$version = $1;
|
|
}
|
|
- elsif ( $out =~ /^tesseract[ ]([\d.]+)/xsm ) {
|
|
+ elsif ( $out =~ /^tesseract-ocr[ ]([\d.]+)/xsm ) {
|
|
$version = $1;
|
|
}
|
|
if ( not $version ) { return }
|
|
if ( $version !~ /^\d+[.]\d+$/xsm ) { $version = 'v' . $version }
|
|
$version = version->parse($version);
|
|
if ( $version > version->parse('v3.02.00') ) {
|
|
- $logger->info("Found tesseract version $version.");
|
|
+ $logger->info("Found tesseract-ocr version $version.");
|
|
$setup = 1;
|
|
return $installed;
|
|
}
|
|
@@ -84,7 +84,7 @@
|
|
if ( not %languages ) {
|
|
my @codes;
|
|
my ( undef, $out, $err ) =
|
|
- Gscan2pdf::Document::exec_command( [ 'tesseract', '--list-langs' ] );
|
|
+ Gscan2pdf::Document::exec_command( [ 'tesseract-ocr', '--list-langs' ] );
|
|
@codes = split /\n/xsm, $err ? $err : $out;
|
|
if ( $codes[0] =~ /^List[ ]of[ ]available[ ]languages/xsm ) {
|
|
shift @codes;
|
|
@@ -97,7 +97,7 @@
|
|
if ( not defined $name ) {
|
|
$name = $code;
|
|
}
|
|
- $logger->info("Found tesseract language $code ($name)");
|
|
+ $logger->info("Found tesseract-ocr language $code ($name)");
|
|
$languages{$code} = $name;
|
|
}
|
|
}
|