summaryrefslogtreecommitdiff
path: root/external/plyer/platforms/macosx/tts.py
diff options
context:
space:
mode:
Diffstat (limited to 'external/plyer/platforms/macosx/tts.py')
-rw-r--r--external/plyer/platforms/macosx/tts.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/external/plyer/platforms/macosx/tts.py b/external/plyer/platforms/macosx/tts.py
new file mode 100644
index 0000000..755e820
--- /dev/null
+++ b/external/plyer/platforms/macosx/tts.py
@@ -0,0 +1,25 @@
+import subprocess
+from plyer.facades import TTS
+from plyer.utils import whereis_exe
+
+
+class NativeSayTextToSpeech(TTS):
+ '''Speaks using the native OSX 'say' command
+ '''
+ def _speak(self, **kwargs):
+ subprocess.call(["say", kwargs.get('message')])
+
+
+class EspeakTextToSpeech(TTS):
+ '''Speaks using the espeak program
+ '''
+ def _speak(self, **kwargs):
+ subprocess.call(["espeak", kwargs.get('message')])
+
+
+def instance():
+ if whereis_exe('say'):
+ return NativeSayTextToSpeech()
+ elif whereis_exe('espeak'):
+ return EspeakTextToSpeech()
+ return TTS()