-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.py
41 lines (35 loc) · 1004 Bytes
/
app.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
32
33
34
35
36
37
38
39
40
41
from gevent import monkey
monkey.patch_all()
from flask import Flask
from flask import render_template
from flask import request
from scripts import imageProcessing
from flask_socketio import SocketIO, emit
import sys
import time
sys.path.append("/scripts/")
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)
@app.route('/')
def index():
return render_template("index.html")
@app.route('/images/<filename>/')
def getImg(filename):
return app.send_static_file('images/' + filename)
@app.route('/dashboard/', methods=['GET'])
def dashboard():
if "command" in request.args:
command = request.args['command']
sendCommand(command)
return render_template('dashboard.html')
@socketio.on('channel-a')
def sendCommand(message):
socketio.emit("channel-a", message)
if __name__ == '__main__':
app.debug = True
socketio.run(app, port=5000)
imageProcessing.init(False)
while(True):
time.sleep(1.5)
imageProcessing.processImage()