fixing ms2playtime
This commit is contained in:
parent
7e0d8c0796
commit
3a8ccbf982
1 changed files with 9 additions and 12 deletions
|
@ -184,19 +184,16 @@ def ms2playtime(ms, hours=False):
|
||||||
>>> ms2playtime(50000000)
|
>>> ms2playtime(50000000)
|
||||||
'13:53:20'
|
'13:53:20'
|
||||||
'''
|
'''
|
||||||
it = int(ms / 1000)
|
d = math.floor(ms / 86400000)
|
||||||
ms = ms - it*1000
|
h = math.floor(ms % 86400000 / 3600000)
|
||||||
ss = it % 60
|
m = math.floor(ms % 3600000 / 60000)
|
||||||
mm = ((it-ss)/60) % 60
|
s = math.floor(ms % 60000 / 1000)
|
||||||
hh = ((it-(mm*60)-ss)/3600) % 60
|
if d:
|
||||||
if hh >= 24:
|
playtime= "%d:%02d:%02d:%02d" % (d, h, m, s)
|
||||||
dd = int(hh / 24)
|
elif h or hours:
|
||||||
hh = hh % 24
|
playtime= "%02d:%02d:%02d" % (h, m, s)
|
||||||
playtime= "%d:%02d:%02d:%02d" % (dd, hh, mm, ss)
|
|
||||||
elif hh or hours:
|
|
||||||
playtime= "%02d:%02d:%02d" % (hh, mm, ss)
|
|
||||||
else:
|
else:
|
||||||
playtime= "%02d:%02d" % (mm, ss)
|
playtime= "%02d:%02d" % (m, s)
|
||||||
return playtime
|
return playtime
|
||||||
|
|
||||||
def ms2time(ms):
|
def ms2time(ms):
|
||||||
|
|
Loading…
Reference in a new issue