From 094a204d9e2d240dd601447862b8d2fcab64b469 Mon Sep 17 00:00:00 2001 From: Peter Marheine Date: Thu, 22 Oct 2015 19:54:14 -0600 Subject: [PATCH] Update player location on server seek. --- syncplay/client.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/syncplay/client.py b/syncplay/client.py index df0d668..0adf967 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -175,10 +175,15 @@ class SyncplayClient(object): seeked = _playerDiff > constants.SEEK_THRESHOLD and _globalDiff > constants.SEEK_THRESHOLD return pauseChange, seeked + def _ignoringPlayerStatus(self, cookie=None): + if cookie is None: + cookie = time.time() + return cookie < self._lastPlayerCommand + self._config['playerCommandDelay'] + def updatePlayerStatus(self, paused, position, cookie=None): # Ignore status report if the cookie is stale - if cookie is not None and \ - cookie < self._lastPlayerCommand + self._config['playerCommandDelay']: + if self._ignoringPlayerStatus(cookie): + self.ui.showDebugMessage('Ignoring stale player status with cookie {}'.format(cookie)) return position -= self.getUserOffset() @@ -515,6 +520,7 @@ class SyncplayClient(object): def setPosition(self, position): if self._lastPlayerUpdate: self._lastPlayerUpdate = time.time() + self._playerPosition = position position += self.getUserOffset() if self._player and self.userlist.currentUser.file: if position < 0: