From 9c8031c47a221310eb59e0b4906af1846ffcbc38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Mon, 12 Feb 2024 18:07:43 +0100 Subject: [PATCH] added artnet converter script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- README.md | 25 +++++++++++++++++++++++-- server/artnet_converter.py | 17 +++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 server/artnet_converter.py diff --git a/README.md b/README.md index 2b6e6f5..74e9c96 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ sudo mysql -u root -p # At the password prompt, just hit enter. We are going to change the root password in a second -alter user root identified by 'a password you write down or remember'; +alter user root@localhost identified by 'a password you write down or remember'; CREATE DATABASE IF NOT EXISTS pixeltube_db; USE pixeltube_db; @@ -236,7 +236,28 @@ exit; sudo systemctl restart apache2 ``` -### Setup Open Lighting Archetecture as the ArtNET sACN middle man: +### Setup Open Lighting Archetecture as the ArtNET/sACN middle man: + +Edit: + +`sudo nano /etc/ola/ola-artnet.conf` + +``` +always_broadcast = false +enabled = true +ip = eth0 +long_name = PiXelTube Master +net = 0 +output_ports = 4 +short_name = PiXelTube Master +subnet = 0 +use_limited_broadcast = false +use_loopback = false +``` + +Save and exit. + + You can access the Pi's OLA webinterface via the following address: diff --git a/server/artnet_converter.py b/server/artnet_converter.py new file mode 100644 index 0000000..9822d6e --- /dev/null +++ b/server/artnet_converter.py @@ -0,0 +1,17 @@ +from scapy.all import * +from scapy.arch import get_if_addr + +def forward_artnet(pkt): + # Check if the packet is an ArtNet packet + if pkt.haslayer(IP) and pkt.haslayer(UDP) and pkt[UDP].dport == 6454: + # Check the source IP address and interface + if pkt[IP].src.startswith("10.0.") and pkt.route()[0] == "eth0": + # Modify the source IP address to the new network + pkt[IP].src = get_if_addr("wlan0") + # Forward the packet to the new network + send(pkt, iface="wlan0") + print("Forwarded ArtNet packet from eth0 to wlan0") + +# Sniff ArtNet packets on eth0 +while True: + sniff(iface="eth0", prn=forward_artnet, store=0) \ No newline at end of file