Commit 5e26a219 authored by Christian Wander's avatar Christian Wander
Browse files

begin with initial config stuff

parent c40bfc6d
from pixelframe import app
from flask import render_template
from flask import render_template, request
import pixelframe.pixel_service as pixel_service
import pixelframe.image_config as config
@app.route('/')
def main_page():
return render_template('main.html')
return "This is the main page"
@app.route('/hello')
def hello_method():
return render_template('hello.html', name="foo")
@app.route('/start', methods=["POST"])
def start_pixels():
pixel_service.doit()
return "Started work."
@app.route('/stop', methods=["POST"])
def stop_pixels():
pixel_service.stopit()
return "Stopped work"
@app.route('/images', methods=["GET", "POST"])
def images():
"""
Endpoint used to set/get the image configuration
"""
if request.method == 'POST':
print(f'>> receiving: {request.json}')
config.update(request.json)
return config.config
config = {
"path": "data",
"images": [
"creeper-12x12.png",
"cyber-12x12.png",
"star2-12x12.png",
"heart-ping-12x12.png"
]
}
def update(data):
# TODO: Check if there's something better to validate json data
print(f'>> updating config: {data}')
if "images" in data:
config['images'] = data['images']
if "path" in data:
config['path'] = data['path']
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment