Like post from the notification client

main
Bob Mottram 2021-03-10 13:04:22 +00:00
parent 4adc5b40bb
commit 8c1e3bca21
1 changed files with 14 additions and 0 deletions

View File

@ -17,6 +17,7 @@ from speaker import getSpeakerFromServer
from speaker import getSpeakerPitch
from speaker import getSpeakerRate
from speaker import getSpeakerRange
from like import sendLikeViaServer
def _waitForKeypress(timeout: int, debug: bool) -> str:
@ -187,6 +188,8 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
nameStr = None
gender = None
messageStr = None
cachedWebfingers = {}
personCache = {}
while (1):
session = createSession(proxyType)
speakerJson = \
@ -305,6 +308,17 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
systemLanguage, espeak)
keyPress = _waitForKeypress(2, debug)
break
elif keyPress == 'like':
if nameStr and gender and messageStr:
_sayCommand('Liking post by ' + nameStr,
screenreader,
systemLanguage, espeak)
sendLikeViaServer(baseDir, session,
nickname, password,
domain, port,
httpPrefix, speakerJson['id'],
cachedWebfingers, personCache,
True, __version__)
elif keyPress == 'repeat' or keyPress == 'rp':
if nameStr and gender and messageStr:
_sayCommand('Repeating ' + nameStr, screenreader,