From b3eb6a97198f64b4e51e7f28a9d5cd748bb3e7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Sat, 17 Feb 2024 00:28:22 +0100 Subject: [PATCH] removed exception MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- server/app.py | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/server/app.py b/server/app.py index d36ac23..74a84c6 100644 --- a/server/app.py +++ b/server/app.py @@ -114,27 +114,22 @@ def start_mqtt_publishers(): mqtt_client = connect_mqtt() artnetBindIp = get_eth0_ip() artNet = Artnet.Artnet(BINDIP = artnetBindIp, DEBUG = True, SHORTNAME = "PiXelTubeMaster", LONGNAME = "PiXelTubeMaster", PORT = 6454) - try: - while True: - try: - # Gets whatever the last Art-Net packet we received is - artNetPacket = artNet.readPacket() - # Make sure we actually *have* a packet - if artNetPacket is not None: - #Checks to see if the current packet is for the specified DMX Universe - dmxPacket = artNetPacket.data - # Create MQTT topic based on the universe and channel - topic = {"PiXelTubes/"+str(artNetPacket.universe)} - - # Publish the DMX value to the MQTT topic - mqtt_client.publish(topic, str(dmxPacket)) - except Exception as e: - print(e) - except KeyboardInterrupt: - artNet.close() - sys.exit() - except Exception as e: - print(e) + while True: + try: + # Gets whatever the last Art-Net packet we received is + artNetPacket = artNet.readPacket() + # Make sure we actually *have* a packet + if artNetPacket is not None: + #Checks to see if the current packet is for the specified DMX Universe + dmxPacket = artNetPacket.data + # Create MQTT topic based on the universe and channel + topic = {"PiXelTubes/"+str(artNetPacket.universe)} + + # Publish the DMX value to the MQTT topic + mqtt_client.publish(topic, str(dmxPacket)) + except KeyboardInterrupt: + artNet.close() + sys.exit() if __name__ == "__main__": flask_thread = Process(target=flask_api)