Rename speaker_client to notifications_client

main
Bob Mottram 2021-03-09 12:03:50 +00:00
parent d31608d3db
commit 6a388a7103
3 changed files with 23 additions and 22 deletions

View File

@ -404,7 +404,7 @@ python3 epicyon.py --speaker yournickname@yourdomain --password [yourpassword]
Or if you have [picospeaker](https://gitlab.com/ky1e/picospeaker) installed:
``` bash
python3 epicyon.py --screenreader picospeaker --speaker yournickname@yourdomain --password [yourpassword]
python3 epicyon.py --screenreader picospeaker --notify yournickname@yourdomain --password [yourpassword]
```
This will then stay running and incoming posts will be announced as they arrive.

View File

@ -76,7 +76,7 @@ from theme import setTheme
from announce import sendAnnounceViaServer
from socnet import instancesGraph
from migrate import migrateAccounts
from speaker_client import runSpeakerClient
from notifications_client import runNotificationsClient
def str2bool(v) -> bool:
@ -433,10 +433,10 @@ parser.add_argument('--level', dest='skillLevelPercent', type=int,
parser.add_argument('--status', '--availability', dest='availability',
type=str, default=None,
help='Set an availability status')
parser.add_argument('--speaker', '--tts', dest='speaker',
parser.add_argument('--notifications', '--notify', dest='notifications',
type=str, default=None,
help='Announce posts as they arrive at your ' +
'inbox using TTS. --speaker [handle]')
help='Notify posts as they arrive at your ' +
'inbox. --notifications [handle]')
parser.add_argument('--block', dest='block', type=str, default=None,
help='Block a particular address')
parser.add_argument('--unblock', dest='unblock', type=str, default=None,
@ -1899,15 +1899,15 @@ if args.availability:
time.sleep(1)
sys.exit()
if args.speaker:
if args.notifications:
# Announce posts as they arrive in your inbox using text-to-speech
if args.speaker.startswith('@'):
args.speaker = args.speaker[1:]
if '@' not in args.speaker:
print('Specify the handle of the speaker nickname@domain')
if args.notifications.startswith('@'):
args.notifications = args.notifications[1:]
if '@' not in args.notifications:
print('Specify the handle to notify: nickname@domain')
sys.exit()
nickname = args.speaker.split('@')[0]
domain = args.speaker.split('@')[1]
nickname = args.notifications.split('@')[0]
domain = args.notifications.split('@')[1]
if not nickname:
print('Specify a nickname with the --nickname option')
@ -1929,10 +1929,10 @@ if args.speaker:
elif args.gnunet:
proxyType = 'gnunet'
runSpeakerClient(baseDir, proxyType, httpPrefix,
nickname, domain, port, args.password,
args.screenreader, args.language,
args.debug)
runNotificationsClient(baseDir, proxyType, httpPrefix,
nickname, domain, port, args.password,
args.screenreader, args.language,
args.debug)
sys.exit()
if federationList:

View File

@ -1,4 +1,4 @@
__filename__ = "speaker_client.py"
__filename__ = "notifications_client.py"
__author__ = "Bob Mottram"
__license__ = "AGPL3+"
__version__ = "1.2.0"
@ -66,11 +66,12 @@ def _speakerPicospeaker(pitch: int, rate: int, systemLanguage: str,
os.system(speakerCmd)
def runSpeakerClient(baseDir: str, proxyType: str, httpPrefix: str,
nickname: str, domain: str, port: int, password: str,
screenreader: str, systemLanguage: str,
debug: bool) -> None:
"""Runs the screen reader client, which announces new inbox items via TTS
def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
nickname: str, domain: str, port: int,
password: str, screenreader: str,
systemLanguage: str, debug: bool) -> None:
"""Runs the notifications and screen reader client,
which announces new inbox items
"""
if screenreader == 'espeak':
print('Setting up espeak')