Add changes
This commit is contained in:
parent
cf9b0e03cc
commit
77a87d4aeb
3 changed files with 10 additions and 12 deletions
4
Pipfile.lock
generated
4
Pipfile.lock
generated
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "804aaad19da42dd0078edca3a25a05492b4832c1a3b2f75601730dc4c7a43a3e"
|
"sha256": "364443464a931653f35034d45ba479e7188a4a9b1cf7af254bb26f8872452ec5"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
"python_version": "3.7"
|
"python_version": "3.6"
|
||||||
},
|
},
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
|
|
10
chat.py
10
chat.py
|
@ -21,13 +21,6 @@ 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
|
||||||
|
@ -93,9 +86,6 @@ def messages_post():
|
||||||
# Save message to serve it in this application
|
# Save message to serve it in this application
|
||||||
messages.append(Message(time, sender, sendertype, message))
|
messages.append(Message(time, sender, sendertype, message))
|
||||||
|
|
||||||
# Send message to espeak to speak it out loud
|
|
||||||
speak(message.encode())
|
|
||||||
|
|
||||||
# Send message to MessageOS
|
# Send message to MessageOS
|
||||||
msg_with_sendr: str = "<{}> {}".format(sender, message) if sender != "somebody" else message
|
msg_with_sendr: str = "<{}> {}".format(sender, message) if sender != "somebody" else message
|
||||||
msg_b64 = base64.b64encode(msg_with_sendr.encode())
|
msg_b64 = base64.b64encode(msg_with_sendr.encode())
|
||||||
|
|
|
@ -4,3 +4,11 @@ killall gunicorn
|
||||||
./run.sh & disown
|
./run.sh & disown
|
||||||
sleep 1
|
sleep 1
|
||||||
DISPLAY=:0 xdotool key F5
|
DISPLAY=:0 xdotool key F5
|
||||||
|
sleep 5
|
||||||
|
DISPLAY=:0 xdotool key F5
|
||||||
|
sleep 10
|
||||||
|
DISPLAY=:0 xdotool key F5
|
||||||
|
sleep 10
|
||||||
|
DISPLAY=:0 xdotool key F5
|
||||||
|
sleep 10
|
||||||
|
DISPLAY=:0 xdotool key F5
|
||||||
|
|
Loading…
Reference in a new issue