image and gif upload and display working
This commit is contained in:
67
server.py
67
server.py
@@ -137,15 +137,58 @@ def Brightness():
|
||||
LastCommand = 'Change Brightness'
|
||||
return hello()
|
||||
|
||||
@app.route("/Display_text", methods=['POST'])
|
||||
def Display_text():
|
||||
@app.route("/DisplayText", methods=['POST'])
|
||||
def DisplayText():
|
||||
text = request.form['text']
|
||||
f = open('csv/scroll_text.csv', 'w+')
|
||||
f.write(text)
|
||||
f.close()
|
||||
ticker.sendline('K')
|
||||
ticker.sendline('T')
|
||||
return hello()
|
||||
|
||||
@app.route("/DisplayImage", methods=['POST'])
|
||||
def DisplayImage():
|
||||
if request.method == 'POST':
|
||||
if 'file' not in request.files:
|
||||
print('No file attached in request')
|
||||
return hello()
|
||||
fle = request.files['file']
|
||||
if fle.filename == '':
|
||||
print('No file selected')
|
||||
return hello()
|
||||
if fle and allowed_file(fle.filename):
|
||||
filename = 'display_image'
|
||||
fle.save(os.path.join(os.path.dirname(os.path.abspath(__file__)), filename))
|
||||
global LastCommand
|
||||
LastCommand = 'Add a new logo file'
|
||||
ticker.sendline('K')
|
||||
ticker.sendline('I')
|
||||
return hello()
|
||||
return hello()
|
||||
|
||||
@app.route("/DisplayGIF", methods=['POST'])
|
||||
def DisplayGIF():
|
||||
|
||||
if request.method == 'POST':
|
||||
if 'file' not in request.files:
|
||||
print('No file attached in request')
|
||||
return hello()
|
||||
fle = request.files['file']
|
||||
if fle.filename == '':
|
||||
print('No file selected')
|
||||
return hello()
|
||||
if fle:
|
||||
print('in')
|
||||
filename = 'display_gif'
|
||||
fle.save(os.path.join(os.path.dirname(os.path.abspath(__file__)), filename))
|
||||
global LastCommand
|
||||
LastCommand = 'Add a new logo file'
|
||||
ticker.sendline('K')
|
||||
ticker.sendline('G')
|
||||
return hello()
|
||||
return hello()
|
||||
|
||||
|
||||
@app.route("/Ticker", methods=['POST'])
|
||||
def Ticker():
|
||||
@@ -153,13 +196,13 @@ def Ticker():
|
||||
if 'file' not in request.files:
|
||||
print('No file attached in request')
|
||||
return hello()
|
||||
file = request.files['file']
|
||||
if file.filename == '':
|
||||
fle = request.files['file']
|
||||
if fle.filename == '':
|
||||
print('No file selected')
|
||||
return hello()
|
||||
if file and allowed_file(file.filename):
|
||||
filename = secure_filename(file.filename)
|
||||
file.save(os.path.join(CSV_FOLDER, filename))
|
||||
if fle and allowed_file(fle.filename):
|
||||
filename = secure_filename(fle.filename)
|
||||
fle.save(os.path.join(CSV_FOLDER, filename))
|
||||
process_file(os.path.join(CSV_FOLDER, filename), filename)
|
||||
global LastCommand
|
||||
LastCommand = 'Change CSV file'
|
||||
@@ -172,13 +215,13 @@ def AddLogo():
|
||||
if 'file' not in request.files:
|
||||
print('No file attached in request')
|
||||
return hello()
|
||||
file = request.files['file']
|
||||
if file.filename == '':
|
||||
fle = request.files['file']
|
||||
if fle.filename == '':
|
||||
print('No file selected')
|
||||
return hello()
|
||||
if file and allowed_file(file.filename):
|
||||
filename = secure_filename(file.filename)
|
||||
file.save(os.path.join(LOGO_FOLDER, filename))
|
||||
if fle and allowed_file(fle.filename):
|
||||
filename = secure_filename(fle.filename)
|
||||
fle.save(os.path.join(LOGO_FOLDER, filename))
|
||||
global LastCommand
|
||||
LastCommand = 'Add a new logo file'
|
||||
return hello()
|
||||
|
Reference in New Issue
Block a user