#!/usr/bin/python """This is an udp / binary client Inspired by the PixelFlut beamer on eth0:winter 2016 and code from https://github.com/defnull/pixelflut/ """ __version__ = 0.2 __author__ = "Jan Klopper " MAX_PROTOCOL_VERSION = 1; PROTOCOL_PREAMBLE = 'pixelvloed' import socket import struct import random import time class MaxSizeList(list): maxsize = 0 def __init__(self, maxcount=100): self.maxsize = maxcount super( MaxSizeList, self ).__init__() def append(self, item): super( MaxSizeList, self ).append(item) if self.__len__() == self.maxsize: raise IndexError('max size reached') def RGBPixel(x, y, r, g, b, a=None): # pylint: disable=C0103 """Generates the packed data for a pixel""" if a: return struct.pack("<2H4B", x, y, r, g, b, a) return struct.pack("<2H3B", x, y, r, g, b) def SetRGBAMode(mode): """Generate the rgb/rgba bit""" return struct.pack("