Fix resume not working

This commit is contained in:
croneter 2020-12-21 10:41:19 +01:00
parent 2ef95b1480
commit 5c81c15cfd
3 changed files with 4 additions and 4 deletions

View file

@ -85,7 +85,7 @@ def process_command(request_path, params):
elif request_path == "player/playback/stop": elif request_path == "player/playback/stop":
js.stop() js.stop()
elif request_path == "player/playback/seekTo": elif request_path == "player/playback/seekTo":
js.seek_to(int(params.get('offset', 0))) js.seek_to(float(params.get('offset', 0.0)) / 1000.0)
elif request_path == "player/playback/stepForward": elif request_path == "player/playback/stepForward":
js.smallforward() js.smallforward()
elif request_path == "player/playback/stepBack": elif request_path == "player/playback/stepBack":

View file

@ -169,12 +169,12 @@ def stop():
def seek_to(offset): def seek_to(offset):
""" """
Seeks all Kodi players to offset [int] in milliseconds Seeks all Kodi players to offset [int] in seconds
""" """
for playerid in get_player_ids(): for playerid in get_player_ids():
return JsonRPC("Player.Seek").execute( return JsonRPC("Player.Seek").execute(
{"playerid": playerid, {"playerid": playerid,
"value": timing.millis_to_kodi_time(offset)}) "value": {'time': timing.millis_to_kodi_time(int(offset * 1000))}})
def smallforward(): def smallforward():

View file

@ -610,5 +610,5 @@ def threaded_playback(kodi_playlist, startpos, offset):
if i > TRY_TO_SEEK_FOR: if i > TRY_TO_SEEK_FOR:
LOG.error('Failed to seek to %s. Error: %s', offset, answ) LOG.error('Failed to seek to %s. Error: %s', offset, answ)
return return
answ = js.seek_to(offset * 1000) answ = js.seek_to(offset)
LOG.debug('Seek to offset %s successful', offset) LOG.debug('Seek to offset %s successful', offset)