aboutsummaryrefslogtreecommitdiff
path: root/phone.py
blob: 59b9cfba428735e87687a9bfdd369e38e95a83e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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])