mirror of https://gitlab.com/bashrc2/epicyon
Remove possibly unsafe characters from spoken strings
parent
2674a7d7f3
commit
b8f98ff042
|
@ -336,6 +336,12 @@ def _getSpeakerJsonFromIndex(boxName: str, index: int) -> {}:
|
|||
return loadJson(speakerJsonFilename)
|
||||
|
||||
|
||||
def _safeMessage(content: str) -> str:
|
||||
"""Removes anything potentially unsafe from a string
|
||||
"""
|
||||
return content.replace('`', '').replace('$(', '$ (')
|
||||
|
||||
|
||||
def _readLocalBoxPost(boxName: str, index: int,
|
||||
systemLanguage: str,
|
||||
screenreader: str, espeak) -> {}:
|
||||
|
@ -374,6 +380,9 @@ def _readLocalBoxPost(boxName: str, index: int,
|
|||
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
||||
return
|
||||
|
||||
_safeMessage(content)
|
||||
_safeMessage(messageStr)
|
||||
|
||||
time.sleep(2)
|
||||
|
||||
# say the speaker's name
|
||||
|
@ -886,6 +895,8 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
|||
time.sleep(2)
|
||||
|
||||
# speak the post content
|
||||
_safeMessage(content)
|
||||
_safeMessage(messageStr)
|
||||
_sayCommand(content, messageStr, screenreader,
|
||||
systemLanguage, espeak,
|
||||
nameStr, gender)
|
||||
|
|
Loading…
Reference in New Issue