From: will Date: Mon, 19 Aug 2024 22:25:57 +0000 (+0100) Subject: Added reciver file for testing and a .gitignore X-Git-Url: https://git.ozva.co.uk/?a=commitdiff_plain;h=f829d7fe112329039d651700e412945af7dcd3e4;p=doomsday-clock Added reciver file for testing and a .gitignore --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a699830 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +./.venv diff --git a/clock.py b/clock.py index 44cf4f4..5e5cfd7 100755 --- a/clock.py +++ b/clock.py @@ -4,13 +4,13 @@ from http.server import HTTPServer, SimpleHTTPRequestHandler from multiprocessing import Process, Array, Value import subprocess import requests +import socket +import struct +import fcntl import time import sacn import sys import os -import socket -import struct -import fcntl # fake GPIO dummy class for debuging class dummy(): diff --git a/reciver.py b/reciver.py new file mode 100755 index 0000000..4e5f750 --- /dev/null +++ b/reciver.py @@ -0,0 +1,27 @@ +#!./.venv/bin/python + +import sacn +import sys +import os + +receiver = sacn.sACNreceiver(bind_address="192.168.8.103") +receiver.start() + +@receiver.listen_on('universe', universe=2) +def callback(packet): + if packet.dmxStartCode == 0x00: + print(packet.dmxData) + +receiver.join_multicast(2) + +try: + while True: + pass + +except KeyboardInterrupt: + receiver.leave_multicast(2) + receiver.stop() + try: + sys.exit() + except SystemExit: + os._exit(130)