warnings.log: one line per entry; longer OCR error text

This commit is contained in:
Audiobook Producer
2026-10-18 01:57:44 -05:00
parent 9e8d902547
commit 568bf7749e
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -30,7 +30,8 @@ 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 + " |")]
lines = keep + ["%s | %s | %s | %s" % (stage, k, w, m) for k, w, m in entries]
one = lambda t: " / ".join(str(t).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 ""))