From fe86fa9e1fd9df4203733e272697a7074c3b2fb4 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Fri, 28 Feb 2020 14:38:02 +0100 Subject: [PATCH] ocr: compat: make a non-existant ocrprogs config variable equivalent to "tesseract" --- src/filters/rclocr.py | 6 +++++- src/sampleconf/recoll.conf | 11 +++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/filters/rclocr.py b/src/filters/rclocr.py index 9bcb1635..40f4d26a 100755 --- a/src/filters/rclocr.py +++ b/src/filters/rclocr.py @@ -81,9 +81,13 @@ if incache: # Retrieve configured OCR program names and try to load the # corresponding module ocrprogs = config.getConfParam("ocrprogs") +if ocrprogs is None: + # Compat: the previous version has no ocrprogs variable, but would do + # tesseract by default. Use "ocrprogs = " for a really empty list + ocrprogs = "tesseract" if not ocrprogs: _deb("No ocrprogs variable in recoll configuration") - sys.exit(1) + sys.exit(0) #_deb("ocrprogs: %s" % ocrprogs) diff --git a/src/sampleconf/recoll.conf b/src/sampleconf/recoll.conf index a72e1f42..32af0f6d 100644 --- a/src/sampleconf/recoll.conf +++ b/src/sampleconf/recoll.conf @@ -905,7 +905,7 @@ snippetMaxPosWalk = 1000000 # # Attempt OCR of PDF files with no text content. # This can be defined in subdirectories. The default is off because -# OCR is so very slow. Will only do anything if ocrprogs is defined. +# OCR is so very slow. # #pdfocr = 0 @@ -946,10 +946,13 @@ snippetMaxPosWalk = 1000000 # OCR modules to try. # The top OCR script will try to load the corresponding modules in # order and use the first which reports being capable of performing OCR on -# the input file. Modules for tesseract and ABBYY FineReader are present in -# the standard distribution. +# the input file. Modules for tesseract (tesseract) and ABBYY FineReader +# (abbyy) are present in the standard distribution. For compatibility with +# the previous version, if this is not defined at all, the default value is +# "tesseract". Use an explicit empty value if needed. A value of "abbyy +# tesseract" will try everything. # -#ocrprogs = abbyy tesseract +#ocrprogs = tesseract # # Location for caching OCR data.