Make notification client display of new posts optional

main
Bob Mottram 2021-03-15 12:59:17 +00:00
parent 1353937804
commit 83514e0640
3 changed files with 29 additions and 12 deletions

View File

@ -406,7 +406,7 @@ python3 epicyon.py --speaker yournickname@yourdomain
Or if you have [picospeaker](https://gitlab.com/ky1e/picospeaker) installed:
``` bash
python3 epicyon.py --screenreader picospeaker --notify yournickname@yourdomain
python3 epicyon.py --notifyShowNewPosts --screenreader picospeaker --notify yournickname@yourdomain
```
You can also use the **--password** option to provide the password. This will then stay running and incoming posts will be announced as they arrive.

View File

@ -300,6 +300,12 @@ parser.add_argument("--noKeyPress",
type=str2bool, nargs='?',
const=True, default=False,
help="Notification daemon does not wait for keypresses")
parser.add_argument("--notifyShowNewPosts",
dest='notifyShowNewPosts',
type=str2bool, nargs='?',
const=True, default=False,
help="Notification client shows/speaks new posts " +
"as they arrive")
parser.add_argument("--noapproval", type=str2bool, nargs='?',
const=True, default=False,
help="Allow followers without approval")
@ -1870,6 +1876,7 @@ if args.notifications:
args.notificationType,
args.noKeyPress,
storeInboxPosts,
args.notifyShowNewPosts,
args.debug)
sys.exit()

View File

@ -596,6 +596,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
notificationType: str,
noKeyPress: bool,
storeInboxPosts: bool,
showNewPosts: bool,
debug: bool) -> None:
"""Runs the notifications and screen reader client,
which announces new inbox items
@ -630,6 +631,15 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
sayStr = '/q or /quit to exit'
_sayCommand(sayStr, sayStr, screenreader,
systemLanguage, espeak)
currTimeline = ''
currInboxIndex = 0
if showNewPosts:
currInboxIndex = 0
_showLocalBox('inbox',
screenreader, systemLanguage, espeak,
currInboxIndex, 10)
currTimeline = 'inbox'
print('')
keyPress = _waitForKeypress(2, debug)
@ -658,8 +668,6 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
personCache = {}
currDMIndex = 0
currSentIndex = 0
currInboxIndex = 0
currTimeline = ''
while (1):
session = createSession(proxyType)
speakerJson = \
@ -765,18 +773,20 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
else:
content = '🔓 ' + messageStr
# say the speaker's name
_sayCommand(nameStr, nameStr, screenreader,
systemLanguage, espeak,
nameStr, gender)
if showNewPosts:
# say the speaker's name
_sayCommand(nameStr, nameStr, screenreader,
systemLanguage, espeak,
nameStr, gender)
time.sleep(2)
time.sleep(2)
# speak the post content
_sayCommand(content, messageStr, screenreader,
systemLanguage, espeak,
nameStr, gender)
# speak the post content
_sayCommand(content, messageStr, screenreader,
systemLanguage, espeak,
nameStr, gender)
# store incoming post
if encryptedMessage:
speakerJson['content'] = content
speakerJson['say'] = messageStr