Install ghostscript fonts (urw-base35) for OCR of PDFs with non-embedded fonts; fuller OCR error text

This commit is contained in:
Audiobook Producer
2026-10-18 01:53:13 -05:00
parent a8ea105b4c
commit 52104b30b9
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -108,5 +108,5 @@ def ocr_if_needed(cfg, book_dir, book):
src = os.path.join(book_dir, book["source_pdf"])
r = subprocess.run(["ocrmypdf", "--skip-text", "-l", cfg["ocr"]["language"], src, out], capture_output=True, text=True)
if r.returncode != 0:
return [("ocr-failed", where, "ocrmypdf exit %d: %s" % (r.returncode, r.stderr.strip()[-300:]))]
return [("ocr-failed", where, "ocrmypdf exit %d: %s" % (r.returncode, (r.stderr.strip()[:300] + " ... " + r.stderr.strip()[-300:]) if len(r.stderr) > 650 else r.stderr.strip()))]
return [("ocr", where, "OCR applied to a scratch copy; original untouched")]