Reworks this logic so it doesn' need a test
This commit is contained in:
parent
5921a551d9
commit
aabfc32183
@ -78,7 +78,7 @@ def binaries_check(app_configs, **kwargs):
|
|||||||
error = "Paperless can't find {}. Without it, consumption is impossible."
|
error = "Paperless can't find {}. Without it, consumption is impossible."
|
||||||
hint = "Either it's not in your ${PATH} or it's not installed."
|
hint = "Either it's not in your ${PATH} or it's not installed."
|
||||||
|
|
||||||
binaries = (settings.CONVERT_BINARY, "tesseract")
|
binaries = (settings.CONVERT_BINARY, "tesseract", "gs")
|
||||||
|
|
||||||
check_messages = []
|
check_messages = []
|
||||||
for binary in binaries:
|
for binary in binaries:
|
||||||
|
@ -21,19 +21,11 @@ def get_tesseract_langs():
|
|||||||
|
|
||||||
@register()
|
@register()
|
||||||
def check_default_language_available(app_configs, **kwargs):
|
def check_default_language_available(app_configs, **kwargs):
|
||||||
if shutil.which("tesseract") is None:
|
# binaries_check in paperless will check and report if this doesn't exist
|
||||||
return [Error("Executable 'tesseract' was not located")]
|
# So skip trying to do anything here and let that handle missing binaries
|
||||||
|
if shutil.which("tesseract") is not None:
|
||||||
installed_langs = get_tesseract_langs()
|
installed_langs = get_tesseract_langs()
|
||||||
|
|
||||||
if not settings.OCR_LANGUAGE:
|
|
||||||
return [
|
|
||||||
Warning(
|
|
||||||
"No OCR language has been specified with PAPERLESS_OCR_LANGUAGE. "
|
|
||||||
"This means that tesseract will fallback to english.",
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
||||||
specified_langs = settings.OCR_LANGUAGE.split("+")
|
specified_langs = settings.OCR_LANGUAGE.split("+")
|
||||||
|
|
||||||
for lang in specified_langs:
|
for lang in specified_langs:
|
||||||
@ -46,4 +38,12 @@ def check_default_language_available(app_configs, **kwargs):
|
|||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if not settings.OCR_LANGUAGE:
|
||||||
|
return [
|
||||||
|
Warning(
|
||||||
|
"No OCR language has been specified with PAPERLESS_OCR_LANGUAGE. "
|
||||||
|
"This means that tesseract will fallback to english.",
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
return []
|
return []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user