Print full ocrmypdf output on failure; sanitize control characters in warnings.log

This commit is contained in:
Audiobook Producer
2026-10-18 02:00:38 -05:00
parent 568bf7749e
commit 50bfa3e239
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ def write_warnings(book_dir, stage, entries):
if os.path.exists(path):
with open(path, encoding="utf-8") as f:
keep = [ln for ln in f.read().splitlines() if ln and not ln.startswith(stage + " |")]
one = lambda t: " / ".join(str(t).split("\n")).strip() # one entry = one line
one = lambda t: " / ".join(re.sub(r"[\x00-\x08\x0b-\x1f]", " ", str(t).replace("\r", "\n")).split("\n")).strip() # one entry = one line
lines = keep + ["%s | %s | %s | %s" % (stage, k, one(w), one(m)) for k, w, m in entries]
with open(path, "w", encoding="utf-8") as f:
f.write("\n".join(lines) + ("\n" if lines else ""))