MCPcopy Create free account
hub / github.com/dtmilano/AndroidViewClient / sayText

Method sayText

src/com/dtmilano/android/viewclient.py:4230–4256  ·  view source on GitHub ↗
(text, voice=None, verbose=False)

Source from the content-addressed store, hash-verified

4228
4229 @staticmethod
4230 def sayText(text, voice=None, verbose=False):
4231 if ViewClient.isLinux:
4232 if verbose:
4233 # FIXME: should use Colors, but for now it's fine
4234 # print in magenta (35)
4235 print("\x1b[{}{}m>> saying: {}\x1b[0m".format(35, '', text))
4236 time.sleep(2)
4237 if DEBUG:
4238 print('Saying "%s" using festival' % text, file=sys.stderr)
4239 pipe = subprocess.Popen(['/usr/bin/festival'])
4240 pipe.communicate('(SayText "%s")' % text)
4241 pipe.terminate()
4242 time.sleep(5)
4243 elif ViewClient.isDarwin:
4244 if verbose:
4245 # FIXME: should use Colors, but for now it's fine
4246 # print in magenta (35)
4247 print("\x1b[{}{}m>> saying: {}\x1b[0m".format(35, '', text))
4248 time.sleep(1)
4249 if not voice:
4250 voice = 'Samantha'
4251 if DEBUG:
4252 print('Saying "%s" as %s' % (text, voice), file=sys.stderr)
4253 subprocess.check_call(['/usr/bin/say', '-v', voice, text])
4254 time.sleep(5)
4255 else:
4256 print("sayText: Unsupported OS: {}".format(ViewClient.osName), file=sys.stderr)
4257
4258 def getViewIds(self):
4259 """

Callers

nothing calls this directly

Calls 1

sleepMethod · 0.45

Tested by

no test coverage detected