From f7b78557b1f6e569b0f9f7e5fc9be8192d5ac38e Mon Sep 17 00:00:00 2001 From: Et0h Date: Sat, 7 May 2016 11:06:04 +0100 Subject: [PATCH] Hopefully fix set to 'not ready' at EOF bug --- syncplay/client.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/syncplay/client.py b/syncplay/client.py index 0a14354..7a7f807 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -190,7 +190,9 @@ class SyncplayClient(object): and abs(position - currentLength ) < constants.PLAYLIST_LOAD_NEXT_FILE_TIME_FROM_END_THRESHOLD: self.playlist.advancePlaylistCheck() elif pauseChange and utils.meetsMinVersion(self.serverVersion, constants.USER_READY_MIN_VERSION): - pauseChange = self._toggleReady(pauseChange, paused) + if currentLength == 0 or currentLength == -1 or\ + not (not self.playlist.notJustChangedPlaylist() and abs(position - currentLength ) < constants.PLAYLIST_LOAD_NEXT_FILE_TIME_FROM_END_THRESHOLD): + pauseChange = self._toggleReady(pauseChange, paused) if self._lastGlobalUpdate: self._lastPlayerUpdate = time.time() @@ -1473,10 +1475,10 @@ class SyncplayPlaylist(): currentLength = self._client.userlist.currentUser.file["duration"] if self._client.userlist.currentUser.file else 0 if currentLength > constants.PLAYLIST_LOAD_NEXT_FILE_MINIMUM_LENGTH\ and abs(position - currentLength ) < constants.PLAYLIST_LOAD_NEXT_FILE_TIME_FROM_END_THRESHOLD\ - and self._notJustChangedPlaylist(): + and self.notJustChangedPlaylist(): self.loadNextFileInPlaylist() - def _notJustChangedPlaylist(self): + def notJustChangedPlaylist(self): secondsSinceLastChange = time.time() - self._lastPlaylistIndexChange return secondsSinceLastChange > constants.PLAYLIST_LOAD_NEXT_FILE_TIME_FROM_END_THRESHOLD