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)
|
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,
|
def _readLocalBoxPost(boxName: str, index: int,
|
||||||
systemLanguage: str,
|
systemLanguage: str,
|
||||||
screenreader: str, espeak) -> {}:
|
screenreader: str, espeak) -> {}:
|
||||||
|
@ -374,6 +380,9 @@ def _readLocalBoxPost(boxName: str, index: int,
|
||||||
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
_safeMessage(content)
|
||||||
|
_safeMessage(messageStr)
|
||||||
|
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
# say the speaker's name
|
# say the speaker's name
|
||||||
|
@ -886,6 +895,8 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
# speak the post content
|
# speak the post content
|
||||||
|
_safeMessage(content)
|
||||||
|
_safeMessage(messageStr)
|
||||||
_sayCommand(content, messageStr, screenreader,
|
_sayCommand(content, messageStr, screenreader,
|
||||||
systemLanguage, espeak,
|
systemLanguage, espeak,
|
||||||
nameStr, gender)
|
nameStr, gender)
|
||||||
|
|
Loading…
Reference in New Issue