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: Or if you have [picospeaker](https://gitlab.com/ky1e/picospeaker) installed:
``` bash ``` 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. 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='?', type=str2bool, nargs='?',
const=True, default=False, const=True, default=False,
help="Notification daemon does not wait for keypresses") 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='?', parser.add_argument("--noapproval", type=str2bool, nargs='?',
const=True, default=False, const=True, default=False,
help="Allow followers without approval") help="Allow followers without approval")
@ -1870,6 +1876,7 @@ if args.notifications:
args.notificationType, args.notificationType,
args.noKeyPress, args.noKeyPress,
storeInboxPosts, storeInboxPosts,
args.notifyShowNewPosts,
args.debug) args.debug)
sys.exit() sys.exit()

View File

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