blc2 - Python library and frontend for running theatrical lighting and SFX. Written for the English 2041F fall 2019 theatre production of "The Cenci".

git clone https://benconnors.ca/git-repos/blc2

Log | Files | Refs

dummy.py (621B) - raw


      1 #!/usr/bin/env python3
      2 
      3 import array
      4 import socket
      5 import threading
      6 
      7 class DummyOutput:
      8     name = "Dummy"
      9 
     10     def set_values(self, values):
     11         v = {c.address[1]: v for c, v in values.items()}
     12         with self._lock:
     13             self.s.sendall(array.array('B', ((0 if i not in v else v[i]) for i in range(64))).tobytes())
     14 
     15     @property
     16     def ok(self):
     17         return True
     18 
     19     @property 
     20     def status(self):
     21         return "Everything's good"
     22 
     23     def __init__(self):
     24         self._lock = threading.RLock()
     25         self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     26         self.s.connect(("", 6969))