-
Notifications
You must be signed in to change notification settings - Fork 3
/
api.py
executable file
·31 lines (30 loc) · 952 Bytes
/
api.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python
import subprocess
import time
import os
songRunning = False
class Data:
def __init__(self, com="", msg="", sp="False"):
self.command = com
self.message = msg
self.speak = sp
def interact(self,duration):
#subprocess.Popen(["notify-send","Dragonfire", self.message])
os.system("xbmc-send --action=\"Notification(\"Dragonfire\"," + self.message + ")\"")
if self.command != "":
time.sleep(duration)
subprocess.Popen(self.command,stdout=subprocess.PIPE)
#if self.speak == True:
# self.say(self.message)
#else:
def say(self,message):
#if songRunning == True:
# subprocess.Popen(["rhythmbox-client","--pause"])
proc = subprocess.Popen(["festival","--tts"],stdin=subprocess.PIPE)
proc.stdin.write(message)
proc.stdin.close()
#proc.wait()
#if songRunning == True:
# subprocess.Popen(["rhythmbox-client","--play"])
def espeak(self,message):
subprocess.Popen(["espeak","-v","en-uk-north",message])