Fix brightness

This commit is contained in:
T 2025-03-06 20:14:52 +01:00
parent b8a5bc45e5
commit d280d2ce96

25
main.py
View File

@ -456,20 +456,14 @@ def index():
return bottle.static_file("index.html", root='html')
@bottle.route("/<filepath:path>")
def serve_static(filepath):
return bottle.static_file(filepath, root='html')
@bottle.route("/setgamma/<r>/<g>/<b>/<w>")
@bottle.route("/setgamma/<r:float>/<g:float>/<b:float>/<w:float>")
def setGamma(r, g, b, w):
runner.setGamma(float(r), float(g), float(b), float(w))
runner.setGamma(r, g, b, w)
return "ok"
@bottle.route("/setbrightness/<i>")
@bottle.route("/setbrightness/<i:float>")
def setIntensity(i):
i = float(i)
if not 0 <= i <= 1:
return "bad_value"
runner.setFilter("0_intensity", filters.MakeBrightnessFilter(i))
@ -513,7 +507,14 @@ def filter_expr():
return "ok"
if __name__ == '__main__':
# generic rule must be the last
@bottle.route("/<filepath:path>")
def serve_static(filepath):
return bottle.static_file(filepath, root='html')
def main():
global running, runner
########################################################################
# Startup #
########################################################################
@ -529,3 +530,7 @@ if __name__ == '__main__':
########################################################################
running = False
runner.join()
if __name__ == '__main__':
main()