Never have negative playstates

This commit is contained in:
croneter 2017-12-14 10:21:30 +01:00
parent c0e7c78a11
commit 0b54e24947

View file

@ -211,11 +211,13 @@ def kodi_time_to_millis(time):
'seconds'[int], 'seconds'[int],
'milliseconds': [int] 'milliseconds': [int]
} }
to milliseconds [int] to milliseconds [int]. Will not return negative results but 0!
""" """
return (time['hours']*3600 + ret = (time['hours'] * 3600 +
time['minutes']*60 + time['minutes'] * 60 +
time['seconds'])*1000 + time['milliseconds'] time['seconds']) * 1000 + time['milliseconds']
ret = 0 if ret < 0 else ret
return ret
def tryEncode(uniString, encoding='utf-8'): def tryEncode(uniString, encoding='utf-8'):