From aceba941fa08a21547589c087fc278f10a4c4d1f Mon Sep 17 00:00:00 2001 From: Et0h Date: Mon, 12 Oct 2015 20:47:51 +0100 Subject: [PATCH] By default only autoplay if all filenames are the same --- syncplay/client.py | 11 +++++++---- syncplay/ui/ConfigurationGetter.py | 4 +++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/syncplay/client.py b/syncplay/client.py index fc7696b..ebbc9f9 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -688,7 +688,7 @@ class SyncplayClient(object): return False def autoplayConditionsMet(self): - return self._playerPaused and self.autoPlay and self.userlist.currentUser.canControl() and self.userlist.isReadinessSupported() and self.userlist.areAllUsersInRoomReady() and self.autoPlayThreshold and self.userlist.usersInRoomCount() >= self.autoPlayThreshold + return self._playerPaused and self.autoPlay 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 def autoplayTimerIsRunning(self): return self.autoplayTimer.running @@ -1117,14 +1117,17 @@ class SyncplayUserlist(object): user = self._users[username] user.setControllerStatus(True) - def areAllUsersInRoomReady(self): + def areAllUsersInRoomReady(self, requireSameFilenames=False): if not self.currentUser.canControl(): return True if not self.currentUser.isReady(): return False for user in self._users.itervalues(): - if user.room == self.currentUser.room and user.isReadyWithFile() == False: - return False + if user.room == self.currentUser.room: + if user.isReadyWithFile() == False: + return False + elif requireSameFilenames and (self.currentUser.file is None or user.file is None or not utils.sameFilename(self.currentUser.file['name'], user.file['name'])): + return False return True def areAllOtherUsersInRoomReady(self): diff --git a/syncplay/ui/ConfigurationGetter.py b/syncplay/ui/ConfigurationGetter.py index 0fa6284..d185086 100755 --- a/syncplay/ui/ConfigurationGetter.py +++ b/syncplay/ui/ConfigurationGetter.py @@ -51,6 +51,7 @@ class ConfigurationGetter(object): "unpauseAction": constants.UNPAUSE_IFOTHERSREADY_MODE, "autoplayInitialState" : None, "autoplayMinUsers" : -1, + "autoplayRequireSameFilenames": True, "clearGUIData": False, "language" : "", "checkForUpdatesAutomatically" : None, @@ -87,6 +88,7 @@ class ConfigurationGetter(object): "dontSlowDownWithMe", "pauseOnLeave", "readyAtStart", + "autoplayRequireSameFilenames", "clearGUIData", "rewindOnDesync", "slowOnDesync", @@ -121,7 +123,7 @@ class ConfigurationGetter(object): self._iniStructure = { "server_data": ["host", "port", "password"], - "client_settings": ["name", "room", "playerPath", "perPlayerArguments", "slowdownThreshold", "rewindThreshold", "fastforwardThreshold", "slowOnDesync", "rewindOnDesync", "fastforwardOnDesync", "dontSlowDownWithMe", "forceGuiPrompt", "filenamePrivacyMode", "filesizePrivacyMode", "unpauseAction", "pauseOnLeave", "readyAtStart", "autoplayMinUsers", "autoplayInitialState", "mediaSearchDirectories"], + "client_settings": ["name", "room", "playerPath", "perPlayerArguments", "slowdownThreshold", "rewindThreshold", "fastforwardThreshold", "slowOnDesync", "rewindOnDesync", "fastforwardOnDesync", "dontSlowDownWithMe", "forceGuiPrompt", "filenamePrivacyMode", "filesizePrivacyMode", "unpauseAction", "pauseOnLeave", "readyAtStart", "autoplayMinUsers", "autoplayInitialState", "autoplayRequireSameFilenames", "mediaSearchDirectories"], "gui": ["showOSD", "showOSDWarnings", "showSlowdownOSD", "showDifferentRoomOSD", "showSameRoomOSD", "showNonControllerOSD", "showDurationNotification"], "general": ["language", "checkForUpdatesAutomatically", "lastCheckedForUpdates"] }