@@ -27,7 +27,7 @@ def compression_ratio(text) -> float:
2727 return len (text ) / len (zlib .compress (text .encode ("utf-8" )))
2828
2929
30- def format_timestamp (seconds : float , always_include_hours : bool = False ):
30+ def format_timestamp (seconds : float , always_include_hours : bool = False , decimal_marker : str = '.' ):
3131 assert seconds >= 0 , "non-negative timestamp expected"
3232 milliseconds = round (seconds * 1000.0 )
3333
@@ -41,7 +41,7 @@ def format_timestamp(seconds: float, always_include_hours: bool = False):
4141 milliseconds -= seconds * 1_000
4242
4343 hours_marker = f"{ hours } :" if always_include_hours or hours > 0 else ""
44- return f"{ hours_marker } { minutes :02d} :{ seconds :02d} . { milliseconds :03d} "
44+ return f"{ hours_marker } { minutes :02d} :{ seconds :02d} { decimal_marker } { milliseconds :03d} "
4545
4646
4747def write_txt (transcript : Iterator [dict ], file : TextIO ):
@@ -79,8 +79,8 @@ def write_srt(transcript: Iterator[dict], file: TextIO):
7979 # write srt lines
8080 print (
8181 f"{ i } \n "
82- f"{ format_timestamp (segment ['start' ], always_include_hours = True )} --> "
83- f"{ format_timestamp (segment ['end' ], always_include_hours = True )} \n "
82+ f"{ format_timestamp (segment ['start' ], always_include_hours = True , decimal_marker = ',' )} --> "
83+ f"{ format_timestamp (segment ['end' ], always_include_hours = True , decimal_marker = ',' )} \n "
8484 f"{ segment ['text' ].strip ().replace ('-->' , '->' )} \n " ,
8585 file = file ,
8686 flush = True ,
0 commit comments