Fix stuff
This commit is contained in:
parent
63ef8de457
commit
8afc0a4e8b
3 changed files with 12 additions and 5 deletions
13
chat.py
13
chat.py
|
@ -20,6 +20,12 @@ last_sent = defaultdict(lambda: datetime(1970,1,1))
|
||||||
timeout = 1
|
timeout = 1
|
||||||
|
|
||||||
|
|
||||||
|
def speak(text):
|
||||||
|
espk_proc = subprocess.Popen(("espeak", "-vnl"), stdin=subprocess.PIPE, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||||
|
espk_proc.stdin.write(text)
|
||||||
|
espk_proc.stdin.close()
|
||||||
|
|
||||||
|
|
||||||
class Message:
|
class Message:
|
||||||
def __init__(self, time, sender, sendertype, msg):
|
def __init__(self, time, sender, sendertype, msg):
|
||||||
self.time = time
|
self.time = time
|
||||||
|
@ -79,10 +85,11 @@ def messages_post():
|
||||||
|
|
||||||
if "spam" in str(message, "UTF-8").lower():
|
if "spam" in str(message, "UTF-8").lower():
|
||||||
messages.append(Message(time, "1.3.3.7", "ip", "Nee"))
|
messages.append(Message(time, "1.3.3.7", "ip", "Nee"))
|
||||||
else:
|
return "OK"
|
||||||
messages.append(Message(time, sender, sendertype, str(message, "UTF-8")))
|
|
||||||
|
messages.append(Message(time, sender, sendertype, str(message, "UTF-8")))
|
||||||
|
speak(message)
|
||||||
|
|
||||||
subprocess.Popen(("espeak", "-vnl"), input=message, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
||||||
return "OK"
|
return "OK"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
killall gunicorn
|
killall gunicorn
|
||||||
./runChat & disown
|
./run.sh & disown
|
||||||
sleep 1
|
sleep 1
|
||||||
DISPLAY=:0 xdotool key F5
|
DISPLAY=:0 xdotool key F5
|
||||||
|
|
2
run.sh
2
run.sh
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
export FLASK_APP=chat.py
|
export FLASK_APP=chat.py
|
||||||
exec gunicorn -w 1 -b127.0.0.1:5000 chat:app
|
exec gunicorn -w 1 -b0.0.0.0:5000 chat:app
|
||||||
|
|
Loading…
Reference in a new issue