Cleanup subtitle related code and make it easier to use SubMaker (#329)

Also don't output subtitles to STDERR by default.

Signed-off-by: rany <rany2@riseup.net>
This commit is contained in:
Rany
2024-11-22 22:57:54 +02:00
committed by GitHub
parent 93fb851cd2
commit 144215496a
3 changed files with 43 additions and 26 deletions

View File

@@ -26,7 +26,7 @@ async def amain() -> None:
if chunk["type"] == "audio":
file.write(chunk["data"])
elif chunk["type"] == "WordBoundary":
submaker.add_cue((chunk["offset"], chunk["duration"]), chunk["text"])
submaker.feed(chunk)
with open(SRT_FILE, "w", encoding="utf-8") as file:
file.write(submaker.get_srt())