improved time remaining display; added pronunciations

This commit is contained in:
2026-03-13 01:07:17 -06:00
parent 8a1362fe0b
commit 125cb25cf8
4 changed files with 819 additions and 11 deletions

View File

@ -142,10 +142,13 @@ def clean_text(text: str) -> str:
def _fmt_duration(seconds: float) -> str:
if seconds >= 60:
m, s = divmod(int(seconds), 60)
h, rem = divmod(int(seconds), 3600)
m, s = divmod(rem, 60)
if h > 0:
return f"{h}h {m:02d}m {s:02d}s"
if m > 0:
return f"{m}m {s:02d}s"
return f"{seconds:.0f}s"
return f"{s}s"
def generate_audio(pipeline: KPipeline, text: str, voice: str,
@ -166,7 +169,7 @@ def generate_audio(pipeline: KPipeline, text: str, voice: str,
sf.write(str(output_path), audio, SAMPLE_RATE)
duration = len(audio) / SAMPLE_RATE
print(f" ✓ Saved '{output_path.name}' "
f"({duration:.1f}s audio | {elapsed:.1f}s wall-clock)")
f"({_fmt_duration(duration)} audio | {_fmt_duration(elapsed)} wall-clock)")
else:
print(f" ✗ No audio produced for voice='{voice}'")
return elapsed
@ -280,7 +283,9 @@ def main() -> None:
total_elapsed_done = sum(e for _, _, e in timing_rows)
if total_elapsed_done > 0:
chars_per_sec = total_done / total_elapsed_done
print(f" ⏱ Calibration: {chars_per_sec:.0f} chars/sec")
remaining = total_chars - total_done
eta_overall = _fmt_duration(remaining / chars_per_sec) if remaining > 0 else "0s"
print(f" ⏱ Speed: {chars_per_sec:.0f} chars/sec | Est. overall remaining: {eta_overall}")
# Summary
print("\n" + "" * 65)