From 7edd5470b0a625d8ed325ca3cd7fb83288c35c25 Mon Sep 17 00:00:00 2001 From: Bob Mottram <bob@freedombone.net> Date: Wed, 10 Mar 2021 12:37:44 +0000 Subject: [PATCH] Command to repeat the last message --- notifications_client.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/notifications_client.py b/notifications_client.py index 45b106e34..351abcb25 100644 --- a/notifications_client.py +++ b/notifications_client.py @@ -184,6 +184,9 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str, shareSoundFilename = 'share.ogg' player = 'ffplay' notificationType = 'notify-send' + nameStr = None + gender = None + messageStr = None while (1): session = createSession(proxyType) speakerJson = \ @@ -270,9 +273,9 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str, # append image description if needed if not speakerJson.get('imageDescription'): - sayStr = speakerJson['say'] + messageStr = speakerJson['say'] else: - sayStr = speakerJson['say'] + '. ' + \ + messageStr = speakerJson['say'] + '. ' + \ speakerJson['imageDescription'] print('') @@ -285,7 +288,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str, time.sleep(2) # speak the post content - _sayCommand(sayStr, screenreader, + _sayCommand(messageStr, screenreader, systemLanguage, espeak, nameStr, gender) @@ -302,6 +305,14 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str, systemLanguage, espeak) keyPress = _waitForKeypress(2, debug) break + elif keyPress == 'repeat' or keyPress == 'rp': + if nameStr and gender and messageStr: + _sayCommand('Repeating ' + nameStr, screenreader, + systemLanguage, espeak, + nameStr, gender) + time.sleep(2) + _sayCommand(messageStr, screenreader, + systemLanguage, espeak) elif keyPress == 'sounds on' or keyPress == 'sound': sayStr = 'Notification sounds on' _sayCommand(sayStr, screenreader,