From 35ba80fc490d448abc99c05698bc83400fc3651f Mon Sep 17 00:00:00 2001 From: Et0h Date: Wed, 28 May 2014 20:27:13 +0100 Subject: [PATCH] Pause on leave = joint notification --- syncplay/client.py | 9 ++++++++- syncplay/messages.py | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/syncplay/client.py b/syncplay/client.py index 2577c66..7334d9e 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -55,6 +55,8 @@ class SyncClientFactory(ClientFactory): class SyncplayClient(object): def __init__(self, playerClass, ui, config): + self.lastLeftTime = 0 + self.lastLeftUser = u"" self.protocolFactory = SyncClientFactory(self) self.ui = UiManager(self, ui) self.userlist = SyncplayUserlist(self.ui, self) @@ -182,7 +184,10 @@ class SyncplayClient(object): self.setPosition(self.getGlobalPosition()) self._player.setPaused(True) madeChangeOnPlayer = True - self.ui.showMessage(getMessage("en", "pause-notification").format(setBy), hideFromOSD) + if (self.lastLeftTime < time.time() - constants.OSD_DURATION) or (hideFromOSD == True): + self.ui.showMessage(getMessage("en", "pause-notification").format(setBy), hideFromOSD) + else: + self.ui.showMessage(getMessage("en", "left-paused-notification").format(self.lastLeftUser, setBy), hideFromOSD) return madeChangeOnPlayer def _serverSeeked(self, position, setBy): @@ -542,6 +547,8 @@ class SyncplayUserlist(object): self._users.pop(username) message = getMessage("en", "left-notification").format(username) self.ui.showMessage(message, hideFromOSD) + self._client.lastLeftTime = time.time() + self._client.lastLeftUser = username self.userListChange() def __displayModUserMessage(self, username, room, file_, user, oldRoom): diff --git a/syncplay/messages.py b/syncplay/messages.py index e534525..aa9f955 100644 --- a/syncplay/messages.py +++ b/syncplay/messages.py @@ -25,6 +25,7 @@ en = { "room-join-notification" : "<{}> has joined the room: '{}'", # User "left-notification" : "<{}> has left", # User + "left-paused-notification" : "<{}> left, <{}> paused", # User who left, User who paused "playing-notification" : "<{}> is playing '{}' ({})", # User, file, duration "playing-notification/room-addendum" : " in room: '{}'", # Room