From e8b77d59cb0bdff4573c12af69ec2b50767a6b66 Mon Sep 17 00:00:00 2001 From: Nicolas Metz Date: Sat, 31 Aug 2024 18:51:10 +0200 Subject: [PATCH 1/4] rewrote input/output variables names and structures for easyer port changes --- hdmix.py | 99 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 74 insertions(+), 25 deletions(-) diff --git a/hdmix.py b/hdmix.py index 6e15e3e..9291c18 100755 --- a/hdmix.py +++ b/hdmix.py @@ -22,6 +22,45 @@ HOST = "172.22.35.189" PORT = 5000 +inputIds = { + "input1": 1, + "input2": 2, + "input3": 3, + "input4": 4, + "input5": 5, + "input6": 6, + "input7": 7, + "input8": 8, +} + +outputIds = { + "output1": 1, # A + "output2": 2, # B + "output3": 3, # C + "output4": 4, # D + "output5": 5, # E + "output6": 6, # F + "output7": 7, # G + "output8": 8, # H +} + +input1Label = "Kabel *space" +input2Label = "Chromecast Main" +input3Label = "Voumeio" +input4Label = "Chromecast Chillout" +input5Label = "" +input6Label = "" +input7Label = "" +input8Label = "Xbox Main" + +output1Label = "Beamer *space" +output2Label = "" +output3Label = "Lautsprecher Chillout" +output4Label = "" +output5Label = "Beamer Chillout" +output6Label = "Lautsprecher *space" +output7Label = "Werkstatt" +output8Label = "Xbox Main" app = Flask(__name__) @@ -46,10 +85,19 @@ def requestMatrixState(): @app.route("/") def index(): matrixState = requestMatrixState() - inputLautsprecherSpace = int(matrixState.split(f"O{matrixIds['LautsprecherSpace']}I")[1][0]) - inputBeamerSpace = int(matrixState.split(f"O{matrixIds['BeamerSpace']}I")[1][0]) - inputBeamerChillecke = int(matrixState.split(f"O{matrixIds['BeamerChillecke']}I")[1][0]) - inputWerkstatt = int(matrixState.split(f"O{matrixIds['Werkstatt']}I")[1][0]) + #inputLautsprecherSpace = int(matrixState.split(f"O{matrixIds['LautsprecherSpace']}I")[1][0]) + #inputBeamerSpace = int(matrixState.split(f"O{matrixIds['BeamerSpace']}I")[1][0]) + #inputBeamerChillecke = int(matrixState.split(f"O{matrixIds['BeamerChillecke']}I")[1][0]) + #inputWerkstatt = int(matrixState.split(f"O{matrixIds['Werkstatt']}I")[1][0]) + + currentInput1 = int(matrixState.split(f"O{outputIds['output1']}I")[1][0]) + currentInput2 = int(matrixState.split(f"O{outputIds['output2']}I")[1][0]) + currentInput3 = int(matrixState.split(f"O{outputIds['output3']}I")[1][0]) + currentInput4 = int(matrixState.split(f"O{outputIds['output4']}I")[1][0]) + currentInput5 = int(matrixState.split(f"O{outputIds['output5']}I")[1][0]) + currentInput6 = int(matrixState.split(f"O{outputIds['output6']}I")[1][0]) + currentInput7 = int(matrixState.split(f"O{outputIds['output7']}I")[1][0]) + currentInput8 = int(matrixState.split(f"O{outputIds['output8']}I")[1][0]) return f""" @@ -68,38 +116,38 @@ def index():

Lautsprecher *space

- - - - - + + + + +

Beamer *space

- - - - - + + + + +

Beamer Chillecke

- - - - - + + + + +

Werkstatt

- - - - - + + + + +
@@ -113,7 +161,8 @@ def switch(): if len(request.args) != 0: for output in request.args: input = request.args.get(output) - switchInput(matrixIds[input], matrixIds[output]) + #switchInput(matrixIds[input], matrixIds[output]) + switchInput(inputIds[input], outputIds[output]) print(f"{input} -> {output}") return redirect("/") From b0433d056dab814cd88697b0afe8f53c161bfa06 Mon Sep 17 00:00:00 2001 From: Nicolas Metz Date: Sat, 31 Aug 2024 20:53:38 +0200 Subject: [PATCH 2/4] fixed button labels --- hdmix.py | 130 +++++++++++++++++++++++++++---------------------------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/hdmix.py b/hdmix.py index 9291c18..064ff54 100755 --- a/hdmix.py +++ b/hdmix.py @@ -23,44 +23,44 @@ PORT = 5000 inputIds = { - "input1": 1, - "input2": 2, - "input3": 3, - "input4": 4, - "input5": 5, - "input6": 6, - "input7": 7, - "input8": 8, + "in1": 1, + "in2": 2, + "in3": 3, + "in4": 4, + "in5": 5, + "in6": 6, + "in7": 7, + "in8": 8, } outputIds = { - "output1": 1, # A - "output2": 2, # B - "output3": 3, # C - "output4": 4, # D - "output5": 5, # E - "output6": 6, # F - "output7": 7, # G - "output8": 8, # H + "outA": 1, + "outB": 2, + "outC": 3, + "outD": 4, + "outE": 5, + "outF": 6, + "outG": 7, + "outH": 8, } -input1Label = "Kabel *space" -input2Label = "Chromecast Main" -input3Label = "Voumeio" -input4Label = "Chromecast Chillout" -input5Label = "" -input6Label = "" -input7Label = "" -input8Label = "Xbox Main" - -output1Label = "Beamer *space" -output2Label = "" -output3Label = "Lautsprecher Chillout" -output4Label = "" -output5Label = "Beamer Chillout" -output6Label = "Lautsprecher *space" -output7Label = "Werkstatt" -output8Label = "Xbox Main" +in1Label = "Kabel *space" +in2Label = "Chromecast Main" +in3Label = "Voumeio" +in4Label = "Chromecast Chillout" +in5Label = "" +in6Label = "" +in7Label = "" +in8Label = "Xbox Main" + +out1Label = "Beamer *space" +out2Label = "" +out3Label = "Lautsprecher Chillout" +out4Label = "" +out5Label = "Beamer Chillout" +out6Label = "Lautsprecher *space" +out7Label = "Werkstatt" +out8Label = "Xbox Main" app = Flask(__name__) @@ -90,14 +90,14 @@ def index(): #inputBeamerChillecke = int(matrixState.split(f"O{matrixIds['BeamerChillecke']}I")[1][0]) #inputWerkstatt = int(matrixState.split(f"O{matrixIds['Werkstatt']}I")[1][0]) - currentInput1 = int(matrixState.split(f"O{outputIds['output1']}I")[1][0]) - currentInput2 = int(matrixState.split(f"O{outputIds['output2']}I")[1][0]) - currentInput3 = int(matrixState.split(f"O{outputIds['output3']}I")[1][0]) - currentInput4 = int(matrixState.split(f"O{outputIds['output4']}I")[1][0]) - currentInput5 = int(matrixState.split(f"O{outputIds['output5']}I")[1][0]) - currentInput6 = int(matrixState.split(f"O{outputIds['output6']}I")[1][0]) - currentInput7 = int(matrixState.split(f"O{outputIds['output7']}I")[1][0]) - currentInput8 = int(matrixState.split(f"O{outputIds['output8']}I")[1][0]) + currentInput1 = int(matrixState.split(f"O{outputIds['outA']}I")[1][0]) + currentInput2 = int(matrixState.split(f"O{outputIds['outB']}I")[1][0]) + currentInput3 = int(matrixState.split(f"O{outputIds['outC']}I")[1][0]) + currentInput4 = int(matrixState.split(f"O{outputIds['outD']}I")[1][0]) + currentInput5 = int(matrixState.split(f"O{outputIds['outE']}I")[1][0]) + currentInput6 = int(matrixState.split(f"O{outputIds['outF']}I")[1][0]) + currentInput7 = int(matrixState.split(f"O{outputIds['outG']}I")[1][0]) + currentInput8 = int(matrixState.split(f"O{outputIds['outH']}I")[1][0]) return f""" @@ -115,39 +115,39 @@ def index():
-

Lautsprecher *space

- - - - - +

"{out6Label}"

+ + + + +
-

Beamer *space

- - - - - +

"{out1Label}"

+ + + + +
-

Beamer Chillecke

- - - - - +

"{out5Label}"

+ + + + +
-

Werkstatt

- - - - - +

"{out7Label}"

+ + + + +
From d3fde5762b638f09f0e752a670ca40296972eedb Mon Sep 17 00:00:00 2001 From: Nicolas Metz Date: Sat, 31 Aug 2024 21:08:59 +0200 Subject: [PATCH 3/4] renamed output Labels; removed quotation marks from button labels; typo Volumio --- hdmix.py | 88 +++++++++++++++++++++----------------------------------- 1 file changed, 33 insertions(+), 55 deletions(-) diff --git a/hdmix.py b/hdmix.py index 064ff54..c86ac63 100755 --- a/hdmix.py +++ b/hdmix.py @@ -3,22 +3,6 @@ from flask import Flask, redirect, request -matrixIds = { - # Inputs - "Kabel *space": 1, - "Chromecast Main": 2, - "Volumio": 3, - "Chromecast Chillecke": 4, - "Xbox Main": 8, - - # Outputs - "BeamerSpace": 1, # A - "LautsprecherChillecke": 3, # C - "LautsprecherSpace": 6, # F - "BeamerChillecke": 5, # E - "Werkstatt": 7, # G -} - HOST = "172.22.35.189" PORT = 5000 @@ -46,21 +30,21 @@ in1Label = "Kabel *space" in2Label = "Chromecast Main" -in3Label = "Voumeio" +in3Label = "Volumio" in4Label = "Chromecast Chillout" in5Label = "" in6Label = "" in7Label = "" in8Label = "Xbox Main" -out1Label = "Beamer *space" -out2Label = "" -out3Label = "Lautsprecher Chillout" -out4Label = "" -out5Label = "Beamer Chillout" -out6Label = "Lautsprecher *space" -out7Label = "Werkstatt" -out8Label = "Xbox Main" +outALabel = "Beamer *space" +outBLabel = "" +outCLabel = "Lautsprecher Chillout" +outDLabel = "" +outELabel = "Beamer Chillout" +outFLabel = "Lautsprecher *space" +outGLabel = "Werkstatt" +outHLabel = "Xbox Main" app = Flask(__name__) @@ -85,11 +69,6 @@ def requestMatrixState(): @app.route("/") def index(): matrixState = requestMatrixState() - #inputLautsprecherSpace = int(matrixState.split(f"O{matrixIds['LautsprecherSpace']}I")[1][0]) - #inputBeamerSpace = int(matrixState.split(f"O{matrixIds['BeamerSpace']}I")[1][0]) - #inputBeamerChillecke = int(matrixState.split(f"O{matrixIds['BeamerChillecke']}I")[1][0]) - #inputWerkstatt = int(matrixState.split(f"O{matrixIds['Werkstatt']}I")[1][0]) - currentInput1 = int(matrixState.split(f"O{outputIds['outA']}I")[1][0]) currentInput2 = int(matrixState.split(f"O{outputIds['outB']}I")[1][0]) currentInput3 = int(matrixState.split(f"O{outputIds['outC']}I")[1][0]) @@ -115,39 +94,39 @@ def index():
-

"{out6Label}"

- - - - - +

"{outFLabel}"

+ + + + +
-

"{out1Label}"

- - - - - +

"{outALabel}"

+ + + + +
-

"{out5Label}"

- - - - - +

"{outELabel}"

+ + + + +
-

"{out7Label}"

- - - - - +

"{outGLabel}"

+ + + + +
@@ -161,7 +140,6 @@ def switch(): if len(request.args) != 0: for output in request.args: input = request.args.get(output) - #switchInput(matrixIds[input], matrixIds[output]) switchInput(inputIds[input], outputIds[output]) print(f"{input} -> {output}") From bb105ced833b04f2e9a8617832907eefb8c004f8 Mon Sep 17 00:00:00 2001 From: Nicolas Metz Date: Sat, 31 Aug 2024 21:15:04 +0200 Subject: [PATCH 4/4] removed quotation marks from output titles --- hdmix.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hdmix.py b/hdmix.py index c86ac63..adf19c7 100755 --- a/hdmix.py +++ b/hdmix.py @@ -94,7 +94,7 @@ def index():
-

"{outFLabel}"

+

{outFLabel}

@@ -103,7 +103,7 @@ def index():
-

"{outALabel}"

+

{outALabel}

@@ -112,7 +112,7 @@ def index():
-

"{outELabel}"

+

{outELabel}

@@ -121,7 +121,7 @@ def index():
-

"{outGLabel}"

+

{outGLabel}