diff --git a/syncplay/client.py b/syncplay/client.py index efe1c77..d1be111 100755 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -39,7 +39,7 @@ except: from syncplay import utils, constants, version from syncplay.constants import PRIVACY_SENDHASHED_MODE, PRIVACY_DONTSEND_MODE, \ PRIVACY_HIDDENFILENAME -from syncplay.messages import getMissingStrings, getMessage +from syncplay.messages import getMissingStrings, getMessage, isNoOSDMessage from syncplay.protocols import SyncClientProtocol from syncplay.utils import isMacOS @@ -1601,6 +1601,10 @@ class UiManager(object): self.__ui.showUserList(currentUser, rooms) def showOSDMessage(self, message, duration=constants.OSD_DURATION, OSDType=constants.OSD_NOTIFICATION, mood=constants.MESSAGE_NEUTRAL): + if(isNoOSDMessage(message)): + print("SKIPPED !!!!! {}".format(message)) + return + autoplayConditionsMet = self._client.autoplayConditionsMet() if OSDType == constants.OSD_ALERT and not constants.SHOW_OSD_WARNINGS and not self._client.autoplayTimerIsRunning(): return diff --git a/syncplay/messages.py b/syncplay/messages.py index a677e1d..23ed80a 100755 --- a/syncplay/messages.py +++ b/syncplay/messages.py @@ -9,6 +9,7 @@ from . import messages_es from . import messages_pt_BR from . import messages_pt_PT from . import messages_tr +import re messages = { "de": messages_de.de, @@ -22,6 +23,10 @@ messages = { "CURRENT": None } +no_osd_message_list = [ + "slowdown-notification", + "revert-notification", +] def getLanguages(): langList = {} @@ -30,11 +35,17 @@ def getLanguages(): langList[lang] = getMessage("LANGUAGE", lang) return langList +def isNoOSDMessage(message): + for no_osd_message in no_osd_message_list: + regex = "^" + getMessage(no_osd_message).replace("{}", ".+") + "$" + regex_test = bool(re.match(regex, message)) + if regex_test: + return True + return False def setLanguage(lang): messages["CURRENT"] = lang - def getMissingStrings(): missingStrings = "" for lang in messages: