From a9c2e033334f08299f0eae591668bdbe9745c742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Thu, 15 Feb 2024 12:31:37 +0100 Subject: [PATCH] test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- server/exampleReceiver.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/exampleReceiver.py b/server/exampleReceiver.py index 3d46867..cdefe8e 100644 --- a/server/exampleReceiver.py +++ b/server/exampleReceiver.py @@ -5,11 +5,19 @@ import os artnet = Artnet.Artnet() +def get_eth0_ip(): + try: + # Get the IP address of the eth0 interface + eth0_ip = str(os.system("ip -4 -o addr show eth0 | awk '{print $4}' | cut -d '/' -f 1 ")) + return eth0_ip + except (KeyError, IndexError, OSError) as e: + print(f"Error getting eth0 IP: {e}") + exit while True: try: - artNetPacket = artnet.readPacket() + artNetPacket = artnet.readPacket(BINDIP=get_eth0_ip) if artNetPacket is not None and artNetPacket.data is not None: if artNetPacket.universe == 0: print("Universe was the specified universe: "+str(artNetPacket.universe))