Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/tts.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-10-11 14:02:01 +0200
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-10-11 14:02:01 +0200
commit2f5aa052a1211fc9c98bd0d5e1cf15059cd6e728 (patch)
tree12128da84447aae506f42f83dc0a68e07650bce8 /archinstall/lib/tts.py
parentd043f487b2b20660e77384e734ad349fab18b3d9 (diff)
Added text-to-speach, untested but the base is now added. It routes through if available. And can be accessed with directly if needed.
Diffstat (limited to 'archinstall/lib/tts.py')
-rw-r--r--archinstall/lib/tts.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/archinstall/lib/tts.py b/archinstall/lib/tts.py
new file mode 100644
index 00000000..d94fbf1e
--- /dev/null
+++ b/archinstall/lib/tts.py
@@ -0,0 +1,36 @@
+class TTS():
+ def __init__(self):
+ try:
+ import pyttsx3
+ self._available = True
+ except:
+ self._available = False
+
+ @property
+ def available(self):
+ return self._available
+ @property
+ def is_available(self):
+ return self._available
+
+ @property
+ def volume(self):
+ return self.engine.getProperty('volume')
+
+ @volume.setter
+ def volume(self, percentage):
+ self.engine.setProperty('volume', percentage/100)
+ return self.volume
+
+
+ def speak(self, phrase):
+ if self.available:
+ self.engine.say("I will speak this text")
+ engine.runAndWait()
+
+ def __enter__(self):
+ self.engine = pyttsx3.init()
+ return self
+
+ def __exit__(self, *args, **kwargs):
+ self.engine.stop() \ No newline at end of file