diff --git a/syncplay/client.py b/syncplay/client.py index ea9ba7b..70d8577 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -82,8 +82,6 @@ class SyncplayClient(object): self._userOffset = 0.0 self._speedChanged = False - self._differentFileMessagesTimesShown = 0 - def initProtocol(self, protocol): self._protocol = protocol @@ -192,16 +190,11 @@ class SyncplayClient(object): madeChangeOnPlayer = True return madeChangeOnPlayer - def _checkRoomForSameFiles(self, paused): roomFilesDiffer = not self.userlist.areAllFilesInRoomSameOnFirstUnpause() - messageShouldBeKept = self._differentFileMessagesTimesShown and self._differentFileMessagesTimesShown < 5 - if ((paused == False and roomFilesDiffer) or messageShouldBeKept): + if (paused == False and roomFilesDiffer): self.userlist.roomCheckedForDifferentFiles() - self._differentFileMessagesTimesShown += 1 - self.ui.showMessage(getMessage("en", "room-files-not-same")) - else: - self._differentFileMessagesTimesShown = 0 + self._player.displayMessage(getMessage("en", "room-files-not-same"), constants.DIFFERENT_FILE_MESSAGE_DURATION) def _changePlayerStateAccordingToGlobalState(self, position, paused, doSeek, setBy): madeChangeOnPlayer = False diff --git a/syncplay/constants.py b/syncplay/constants.py index 0e52c27..1112572 100644 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -1,6 +1,7 @@ #You might want to change these DEFAULT_PORT = 8999 OSD_DURATION = 3000 +DIFFERENT_FILE_MESSAGE_DURATION = 15000 MPC_OSD_POSITION = 2 #Right corner, 1 for left MPLAYER_OSD_LEVEL = 1 UI_TIME_FORMAT = "[%X] " diff --git a/syncplay/players/mpc.py b/syncplay/players/mpc.py index 1d97a2b..d2db729 100644 --- a/syncplay/players/mpc.py +++ b/syncplay/players/mpc.py @@ -381,8 +381,8 @@ class MPCHCAPIPlayer(BasePlayer): if(filePath): self._mpcApi.openFile(filePath) - def displayMessage(self, message): - self._mpcApi.sendOsd(message) + def displayMessage(self, message, duration = constants.OSD_DURATION): + self._mpcApi.sendOsd(message, constants.MPC_OSD_POSITION, duration) @retry(MpcHcApi.PlayerNotReadyException, constants.MPC_MAX_RETRIES, constants.MPC_RETRY_WAIT_TIME, 1) def setPaused(self, value): diff --git a/syncplay/players/mplayer.py b/syncplay/players/mplayer.py index 15eb2c8..3931f5b 100644 --- a/syncplay/players/mplayer.py +++ b/syncplay/players/mplayer.py @@ -72,8 +72,8 @@ class MplayerPlayer(BasePlayer): def _getProperty(self, property_): self._listener.sendLine("get_property {}".format(property_)) - def displayMessage(self, message): - self._listener.sendLine('osd_show_text "{!s}" {} {}'.format(message, constants.OSD_DURATION, constants.MPLAYER_OSD_LEVEL)) + def displayMessage(self, message, duration = constants.OSD_DURATION): + self._listener.sendLine('osd_show_text "{!s}" {} {}'.format(message, duration, constants.MPLAYER_OSD_LEVEL)) def setSpeed(self, value): self._setProperty('speed', "{:.2f}".format(value))