process: keep the original run.log when a re-run renders nothing; dispatch input to override the voice URL (testing); drop netcheck
This commit is contained in:
@@ -193,6 +193,7 @@ def run_text_stages(cfg, pdf, title, author):
|
||||
|
||||
|
||||
def run_audio_stages(cfg, book_dir, book, force):
|
||||
"""Returns True if any audio was rendered."""
|
||||
out_dir = settings.audio_dir(cfg, book_dir)
|
||||
built = book.setdefault("audio_built", {})
|
||||
todo = []
|
||||
@@ -228,10 +229,12 @@ def run_audio_stages(cfg, book_dir, book, force):
|
||||
print("voice model unloaded to free the GPU")
|
||||
else:
|
||||
print("nothing to render")
|
||||
rendered = bool(todo)
|
||||
step("ACX check")
|
||||
rc = acx_check.run(cfg, [out_dir])
|
||||
if rc != 0:
|
||||
raise Failed("ACX check FAILED (see the table above); nothing should be committed")
|
||||
return rendered
|
||||
|
||||
|
||||
def process(cfg, pdf, dry_run=False, force=False, title=None, author=None, compare=None, result_file=None, compare_strict=False):
|
||||
@@ -244,6 +247,7 @@ def process(cfg, pdf, dry_run=False, force=False, title=None, author=None, compa
|
||||
real_out = sys.stdout
|
||||
sys.stdout = Tee(real_out, log)
|
||||
book_dir = None
|
||||
rendered = False
|
||||
try:
|
||||
print("process %s%s" % (os.path.basename(pdf), " [DRY RUN: text stages only]" if dry_run else ""))
|
||||
book_dir, book = run_text_stages(cfg, pdf, title, author)
|
||||
@@ -269,7 +273,7 @@ def process(cfg, pdf, dry_run=False, force=False, title=None, author=None, compa
|
||||
print("voice server reachable:", h)
|
||||
else:
|
||||
try:
|
||||
run_audio_stages(cfg, book_dir, book, force)
|
||||
rendered = run_audio_stages(cfg, book_dir, book, force)
|
||||
except voice.VoiceError as e:
|
||||
raise Failed("voice: %s" % e)
|
||||
print("\nPROCESS OK: %s" % book_dir)
|
||||
@@ -284,7 +288,7 @@ def process(cfg, pdf, dry_run=False, force=False, title=None, author=None, compa
|
||||
rc = 1
|
||||
finally:
|
||||
sys.stdout = real_out
|
||||
if rc == 0 and book_dir and not dry_run:
|
||||
if rc == 0 and book_dir and not dry_run and rendered: # a re-run that renders nothing keeps the original log
|
||||
out_dir = settings.audio_dir(cfg, book_dir)
|
||||
os.makedirs(out_dir, exist_ok=True)
|
||||
with open(os.path.join(out_dir, "run.log"), "w", encoding="utf-8") as f:
|
||||
|
||||
Reference in New Issue
Block a user