time format fixes in generated .srt files

This commit is contained in:
chiprodoy
2023-11-16 01:32:01 +00:00
committed by Miguel Piedrafita
parent 6462cd4d56
commit eeed02cbb3
4 changed files with 163 additions and 2 deletions
+2 -2
View File
@@ -26,8 +26,8 @@ def format_timestamp(seconds: float, always_include_hours: bool = False):
seconds = milliseconds // 1_000
milliseconds -= seconds * 1_000
hours_marker = f"{hours}:" if always_include_hours or hours > 0 else ""
return f"{hours_marker}{minutes:02d}:{seconds:02d}.{milliseconds:03d}"
hours_marker = f"{hours:02d}:" if always_include_hours or hours > 0 else ""
return f"{hours_marker}{minutes:02d}:{seconds:02d},{milliseconds:03d}"
def write_srt(transcript: Iterator[dict], file: TextIO):