diff options
author | Mark Powers <mark@marks.kitchen> | 2021-07-11 04:03:59 +0100 |
---|---|---|
committer | Mark Powers <mark@marks.kitchen> | 2021-07-11 04:03:59 +0100 |
commit | a981a50b0597498a9fc92249f93f940998455ca3 (patch) | |
tree | 6ec956fc4946878809a29e6bd333c48c8bbdf2bd /phone.py |
Initial commit
Diffstat (limited to 'phone.py')
-rw-r--r-- | phone.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/phone.py b/phone.py new file mode 100644 index 0000000..59b9cfb --- /dev/null +++ b/phone.py @@ -0,0 +1,16 @@ +import subprocess + +class PhoneManager: + def handle_event(self, event): + print("handling event", event) + if event == "fortune": + res = subprocess.run(["fortune"], stdout=subprocess.PIPE) + output = res.stdout.decode("utf-8") + self.speak(output) + else: + self.speak(event) + + + def speak(self, text): + print("speaking:", text) + subprocess.run(["espeak", text]) |