Fix resume not working in some cases

This commit is contained in:
croneter 2019-10-25 13:41:54 +02:00
parent 2481606cd7
commit ca52117c4f

View file

@ -63,25 +63,21 @@ def kodi_now():
def millis_to_kodi_time(milliseconds): def millis_to_kodi_time(milliseconds):
""" """
Converts time in milliseconds to the time dict used by the Kodi JSON RPC: Converts time in milliseconds [int or float] to the time dict used by the
Kodi JSON RPC:
{ {
'hours': [int], 'hours': [int],
'minutes': [int], 'minutes': [int],
'seconds'[int], 'seconds'[int],
'milliseconds': [int] 'milliseconds': [int]
} }
Pass in the time in milliseconds as an int
""" """
seconds = int(milliseconds / 1000) seconds = int(milliseconds / 1000)
minutes = int(seconds / 60) minutes = int(seconds / 60)
seconds = seconds % 60 return {'hours': int(minutes / 60),
hours = int(minutes / 60) 'minutes': int(minutes % 60),
minutes = minutes % 60 'seconds': int(seconds % 60),
milliseconds = milliseconds % 1000 'milliseconds': int(milliseconds % 1000)}
return {'hours': hours,
'minutes': minutes,
'seconds': seconds,
'milliseconds': milliseconds}
def kodi_time_to_millis(time): def kodi_time_to_millis(time):