Merge pull request #116 from esha71/master
Fixed timestamp formatting in WebVTTFormatter
This commit is contained in:
commit
f30e344f99
|
@ -95,13 +95,10 @@ class WebVTTFormatter(Formatter):
|
||||||
'00:00:06.930'
|
'00:00:06.930'
|
||||||
"""
|
"""
|
||||||
time = float(time)
|
time = float(time)
|
||||||
hours, mins, secs = (
|
hours, remainder = divmod(time, 3600)
|
||||||
int(time) // 3600,
|
mins, secs = divmod(remainder, 60)
|
||||||
int(time) // 60,
|
|
||||||
int(time) % 60,
|
|
||||||
)
|
|
||||||
ms = int(round((time - int(time))*1000, 2))
|
ms = int(round((time - int(time))*1000, 2))
|
||||||
return "{:02d}:{:02d}:{:02d}.{:03d}".format(hours, mins, secs, ms)
|
return "{:02.0f}:{:02.0f}:{:02.0f}.{:03d}".format(hours, mins, secs, ms)
|
||||||
|
|
||||||
def format_transcript(self, transcript, **kwargs):
|
def format_transcript(self, transcript, **kwargs):
|
||||||
"""A basic implementation of WEBVTT formatting.
|
"""A basic implementation of WEBVTT formatting.
|
||||||
|
|
Loading…
Reference in New Issue