Do not show playback speed change notifications in OSD

This commit is contained in:
et0h 2021-03-03 20:47:19 +00:00
parent aeada06d33
commit 2eacee571d
2 changed files with 17 additions and 2 deletions

View File

@ -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

View File

@ -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: