MCPcopy Index your code
hub / github.com/modelscope/FunClip / time_convert

Function time_convert

funclip/utils/subtitle_utils.py:7–22  ·  view source on GitHub ↗
(ms)

Source from the content-addressed store, hash-verified

5import re
6
7def time_convert(ms):
8 ms = int(ms)
9 tail = ms % 1000
10 s = ms // 1000
11 mi = s // 60
12 s = s % 60
13 h = mi // 60
14 mi = mi % 60
15 h = "00" if h == 0 else str(h)
16 mi = "00" if mi == 0 else str(mi)
17 s = "00" if s == 0 else str(s)
18 tail = str(tail).zfill(3)
19 if len(h) == 1: h = '0' + h
20 if len(mi) == 1: mi = '0' + mi
21 if len(s) == 1: s = '0' + s
22 return "{}:{}:{},{}".format(h, mi, s, tail)
23
24def str2list(text):
25 pattern = re.compile(r'[\u4e00-\u9fff]|[\w-]+', re.UNICODE)

Callers 2

__init__Method · 0.85
srtMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected