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

View File

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