summaryrefslogtreecommitdiff
path: root/external/plyer/platforms/linux/tts.py
diff options
context:
space:
mode:
authorLivio Recchia <recchialivio@libero.it>2020-02-10 23:06:34 +0100
committerLivio Recchia <recchialivio@libero.it>2020-02-10 23:06:34 +0100
commit9a13903a2f7d3a65fdf15a65fb59cccd622e2066 (patch)
tree9403b7dff39eb5e5d7fa0f79efb69b496add4c4b /external/plyer/platforms/linux/tts.py
parent11cc316b74d5f3f283413a33e7693b314741aa4a (diff)
downloadmanachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.gz
manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.bz2
manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.xz
manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.zip
Initial commit
Diffstat (limited to 'external/plyer/platforms/linux/tts.py')
-rw-r--r--external/plyer/platforms/linux/tts.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/external/plyer/platforms/linux/tts.py b/external/plyer/platforms/linux/tts.py
new file mode 100644
index 0000000..0a609e1
--- /dev/null
+++ b/external/plyer/platforms/linux/tts.py
@@ -0,0 +1,25 @@
+import subprocess
+from plyer.facades import TTS
+from plyer.utils import whereis_exe
+
+
+class EspeakTextToSpeech(TTS):
+ ''' Speaks using the espeak program
+ '''
+ def _speak(self, **kwargs):
+ subprocess.call(["espeak", kwargs.get('message')])
+
+
+class FliteTextToSpeech(TTS):
+ ''' Speaks using the flite program
+ '''
+ def _speak(self):
+ subprocess.call(["flite", "-t", kwargs.get('message'), "play"])
+
+
+def instance():
+ if whereis_exe('espeak'):
+ return EspeakTextToSpeech()
+ elif whereis_exe('flite'):
+ return FlitetextToSpeech()
+ return TTS()