From e295b8ad413a49b6465d21eb8fb981469dfe1404 Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 17 Oct 2016 14:02:06 +0100 Subject: [PATCH] Auto-play after playlist advances --- syncplay/client.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/syncplay/client.py b/syncplay/client.py index 2f52014..69f0dab 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -480,6 +480,7 @@ class SyncplayClient(object): if resetPosition: self.establishRewindDoubleCheck() self.lastRewindTime = time.time() + self.autoplayCheck() def fileSwitchFoundFiles(self): self.ui.fileSwitchFoundFiles() @@ -693,9 +694,10 @@ class SyncplayClient(object): return False def autoplayConditionsMet(self): - return self._playerPaused and self.autoPlay and self.userlist.currentUser.canControl() and self.userlist.isReadinessSupported()\ + recentlyReset = (self.lastRewindTime is not None and abs(time.time() - self.lastRewindTime) < 10) and self._playerPosition < 3 + return self._playerPaused and (self.autoPlay or recentlyReset) and self.userlist.currentUser.canControl() and self.userlist.isReadinessSupported()\ and self.userlist.areAllUsersInRoomReady(requireSameFilenames=self._config["autoplayRequireSameFilenames"])\ - and self.autoPlayThreshold and self.userlist.usersInRoomCount() >= self.autoPlayThreshold + and ((self.autoPlayThreshold and self.userlist.usersInRoomCount() >= self.autoPlayThreshold) or recentlyReset) def autoplayTimerIsRunning(self): return self.autoplayTimer.running @@ -1768,4 +1770,4 @@ class FileSwitchManager(object): if self.isDirectoryInList(directoryToFind, self.mediaDirectories): return self._client.ui.showErrorMessage(getMessage("added-file-not-in-media-directory-error").format(directoryToFind)) - self.mediaDirectoriesNotFound.append(directoryToFind) \ No newline at end of file + self.mediaDirectoriesNotFound.append(directoryToFind)