From d59afb8f2fc6d2accc114ac0eee38cccf5ef17da Mon Sep 17 00:00:00 2001 From: xNinjaKittyx Date: Mon, 23 Jul 2018 14:41:10 -0700 Subject: [PATCH] Revert any changes to tri logic --- syncplay/client.py | 20 ++++++++++---------- syncplay/players/mplayer.py | 6 +++--- syncplay/players/mpv.py | 4 ++-- syncplay/players/vlc.py | 4 ++-- syncplay/ui/ConfigurationGetter.py | 2 +- syncplay/ui/gui.py | 6 +++--- syncplay/utils.py | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/syncplay/client.py b/syncplay/client.py index 3d14659..3bbb97b 100755 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -317,7 +317,7 @@ class SyncplayClient(object): self.setPosition(self.getGlobalPosition()) self._player.setPaused(True) madeChangeOnPlayer = True - if (self.lastLeftTime < time.time() - constants.OSD_DURATION) or hideFromOSD: + if (self.lastLeftTime < time.time() - constants.OSD_DURATION) or hideFromOSD == True: self.ui.showMessage(getMessage("pause-notification").format(setBy), hideFromOSD) else: self.ui.showMessage(getMessage("left-paused-notification").format(self.lastLeftUser, setBy), hideFromOSD) @@ -364,9 +364,9 @@ class SyncplayClient(object): self._lastGlobalUpdate = time.time() if doSeek: madeChangeOnPlayer = self._serverSeeked(position, setBy) - if diff > self._config['rewindThreshold'] and not doSeek and self._config['rewindOnDesync']: + if diff > self._config['rewindThreshold'] and not doSeek and not self._config['rewindOnDesync'] == False: madeChangeOnPlayer = self._rewindPlayerDueToTimeDifference(position, setBy) - if self._config['fastforwardOnDesync'] and (not self.userlist.currentUser.canControl() or self._config['dontSlowDownWithMe']): + if self._config['fastforwardOnDesync'] and (self.userlist.currentUser.canControl() == False or self._config['dontSlowDownWithMe'] == True): if diff < (constants.FASTFORWARD_BEHIND_THRESHOLD * -1) and not doSeek: if self.behindFirstDetected is None: self.behindFirstDetected = time.time() @@ -378,11 +378,11 @@ class SyncplayClient(object): self.behindFirstDetected = time.time() + constants.FASTFORWARD_RESET_THRESHOLD else: self.behindFirstDetected = None - if self._player.speedSupported and not doSeek and not paused and self._config['slowOnDesync']: + if self._player.speedSupported and not doSeek and not paused and not self._config['slowOnDesync'] == False: madeChangeOnPlayer = self._slowDownToCoverTimeDifference(diff, setBy) - if not paused and pauseChanged: + if paused == False and pauseChanged: madeChangeOnPlayer = self._serverUnpaused(setBy) - elif paused and pauseChanged: + elif paused == True and pauseChanged: madeChangeOnPlayer = self._serverPaused(setBy) return madeChangeOnPlayer @@ -774,7 +774,7 @@ class SyncplayClient(object): from syncplay.ui.ConfigurationGetter import ConfigurationGetter ConfigurationGetter().setConfigOption("sharedPlaylistEnabled", newState) self._config["sharedPlaylistEnabled"] = newState - if not oldState and newState: + if oldState == False and newState == True: self.playlist.loadCurrentPlaylistIndex() def changeAutoplayState(self, newState): @@ -785,7 +785,7 @@ class SyncplayClient(object): oldAutoplayConditionsMet = self.autoplayConditionsMet() self.autoPlayThreshold = newThreshold newAutoplayConditionsMet = self.autoplayConditionsMet() - if not oldAutoplayConditionsMet and newAutoplayConditionsMet: + if oldAutoplayConditionsMet == False and newAutoplayConditionsMet == True: self.autoplayCheck() def autoplayCheck(self): @@ -1158,7 +1158,7 @@ class SyncplayUserlist(object): showOnOSD = constants.SHOW_OSD_WARNINGS else: showOnOSD = constants.SHOW_DIFFERENT_ROOM_OSD - if constants.SHOW_NONCONTROLLER_OSD == False and not self.canControl(username): + if constants.SHOW_NONCONTROLLER_OSD == False and self.canControl(username) == False: showOnOSD = False hideFromOSD = not showOnOSD if not file_: @@ -1275,7 +1275,7 @@ class SyncplayUserlist(object): return False for user in self._users.values(): if user.room == self.currentUser.room: - if not user.isReadyWithFile() == False: + if user.isReadyWithFile() == False: return False elif ( requireSameFilenames and diff --git a/syncplay/players/mplayer.py b/syncplay/players/mplayer.py index c46c74a..69fa0d2 100755 --- a/syncplay/players/mplayer.py +++ b/syncplay/players/mplayer.py @@ -396,11 +396,11 @@ class MplayerPlayer(BasePlayer): oldState = self.readyToSend self.readyToSend = newReadyState self.lastNotReadyTime = time.time() if newReadyState == False else None - if self.readyToSend: + if self.readyToSend == True: self.__playerController._client.ui.showDebugMessage(" Ready to send: True") else: self.__playerController._client.ui.showDebugMessage(" Ready to send: False") - if self.readyToSend and oldState == False: + if self.readyToSend == True and oldState == False: self.processSendQueue() def checkForReadinessOverride(self): @@ -409,7 +409,7 @@ class MplayerPlayer(BasePlayer): def sendLine(self, line, notReadyAfterThis=None): self.checkForReadinessOverride() - if not self.readyToSend and "print_text ANS_pause" in line: + if self.readyToSend == False and "print_text ANS_pause" in line: self.__playerController._client.ui.showDebugMessage(" Not ready to get status update, so skipping") return try: diff --git a/syncplay/players/mpv.py b/syncplay/players/mpv.py index 3ade92c..01db64d 100755 --- a/syncplay/players/mpv.py +++ b/syncplay/players/mpv.py @@ -164,7 +164,7 @@ class NewMpvPlayer(OldMpvPlayer): self._listener.sendLine("print_text ""ANS_{}=${{{}}}""".format(property_, propertyID)) def getCalculatedPosition(self): - if not self.fileLoaded: + if self.fileLoaded == False: self._client.ui.showDebugMessage( "File not loaded so using GlobalPosition for getCalculatedPosition({})".format( self._client.getGlobalPosition())) @@ -266,7 +266,7 @@ class NewMpvPlayer(OldMpvPlayer): self._client.ui.showDebugMessage("Want to set paused to {}".format(self._client.getGlobalPaused())) else: self._client.ui.showDebugMessage("Don't want to set paused to {}".format(self._client.getGlobalPaused())) - if not resetPosition: + if resetPosition == False: self.setPosition(self._client.getGlobalPosition()) else: self._storePosition(0) diff --git a/syncplay/players/vlc.py b/syncplay/players/vlc.py index 0c140a6..ab5e611 100755 --- a/syncplay/players/vlc.py +++ b/syncplay/players/vlc.py @@ -223,7 +223,7 @@ class VlcPlayer(BasePlayer): self._duration = float(value.replace(",", ".")) self._durationAsk.set() elif name == "playstate": - self._paused = bool(value != 'playing') if (value != "no-input" and not self._filechanged) else self._client.getGlobalPaused() + self._paused = bool(value != 'playing') if (value != "no-input" and self._filechanged == False) else self._client.getGlobalPaused() diff = time.time() - self._lastVLCPositionUpdate if self._lastVLCPositionUpdate else 0 if ( self._paused == False and @@ -507,4 +507,4 @@ class VlcPlayer(BasePlayer): try: self.__process.terminate() except: # When VLC is already closed - pass \ No newline at end of file + pass diff --git a/syncplay/ui/ConfigurationGetter.py b/syncplay/ui/ConfigurationGetter.py index b505976..8af06f4 100755 --- a/syncplay/ui/ConfigurationGetter.py +++ b/syncplay/ui/ConfigurationGetter.py @@ -284,7 +284,7 @@ class ConfigurationGetter(object): elif key == "host": self._config["host"], self._config["port"] = self._splitPortAndHost(self._config["host"]) hostNotValid = (self._config["host"] == "" or self._config["host"] is None) - portNotValid = (not _isPortValid(self._config["port"])) + portNotValid = (_isPortValid(self._config["port"]) == False) if hostNotValid: raise InvalidConfigValue(getMessage("no-hostname-config-error")) elif portNotValid: diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py index 3bfecc5..31ffa81 100755 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -887,7 +887,7 @@ class MainWindow(QtWidgets.QMainWindow): @needsClient def browseMediapath(self): - if self._syncplayClient._player.customOpenDialog: + if self._syncplayClient._player.customOpenDialog == True: self._syncplayClient._player.openCustomOpenDialog() return @@ -916,7 +916,7 @@ class MainWindow(QtWidgets.QMainWindow): @needsClient def OpenAddFilesToPlaylistDialog(self): - if self._syncplayClient._player.customOpenDialog: + if self._syncplayClient._player.customOpenDialog == True: self._syncplayClient._player.openCustomOpenDialog() return @@ -1659,7 +1659,7 @@ class MainWindow(QtWidgets.QMainWindow): dropfilepath = os.path.abspath(NSURL.URLWithString_(pathString).filePathURL().path()) else: dropfilepath = os.path.abspath(str(url.toLocalFile())) - if not rewindFile: + if rewindFile == False: self._syncplayClient._player.openFile(dropfilepath) else: self._syncplayClient.setPosition(0) diff --git a/syncplay/utils.py b/syncplay/utils.py index 7a7c452..4331b8f 100755 --- a/syncplay/utils.py +++ b/syncplay/utils.py @@ -440,7 +440,7 @@ def getListOfPublicServers(): else: raise IOError except: - if constants.DEBUG_MODE: + if constants.DEBUG_MODE == True: traceback.print_exc() raise else: