diff --git a/colorpalette.txt b/colorpalette.txt new file mode 100644 index 0000000..6f18e31 --- /dev/null +++ b/colorpalette.txt @@ -0,0 +1,16 @@ +#FFFFFF +#E4E4E4 +#888888 +#222222 +#FFA7D1 +#E50000 +#E59500 +#A06A42 +#E5D900 +#94E044 +#02BE01 +#00D3DD +#0083C7 +#0000EA +#CF6EE4 +#820080 \ No newline at end of file diff --git a/frontend/src/components/PlaceCanvas.vue b/frontend/src/components/PlaceCanvas.vue new file mode 100644 index 0000000..3dc5265 --- /dev/null +++ b/frontend/src/components/PlaceCanvas.vue @@ -0,0 +1,26 @@ + + + + + + diff --git a/python/clients.py b/python/clients.py index d02dee0..b8846a8 100644 --- a/python/clients.py +++ b/python/clients.py @@ -59,23 +59,25 @@ def closest_match(rgb, color_map): return min(range(len(rgb_colors)), key=lambda i: eucleadian_distance(rgb, color_map[i])) async def sender(img): - async with websockets.connect("ws://localhost:8080/set", timeout=60) as websocket: - - while True: - rx = random.randint(0, 999) - ry = random.randint(0, 999) - message = pixel( - x=rx, - y=ry, - color= closest_match(img[rx][ry], rgb_colors), - timestamp=int(time.time()), - userid=1, - ) - await websocket.send(json.dumps(message.__dict__)) - succ = await websocket.recv() - if succ != "0": - print(message, "was not set") - + while True: + try: + async with websockets.connect("ws://localhost:8080/set", timeout=60) as websocket: + while True: + rx = random.randint(0, 999) + ry = random.randint(0, 999) + message = pixel( + x=rx, + y=ry, + color= closest_match(img[rx][ry], rgb_colors), + timestamp=int(time.time()), + userid=1, + ) + await websocket.send(json.dumps(message.__dict__)) + succ = await websocket.recv() + if succ != "0": + print(message, "was not set") + except: + print("reconnecting") async def client(): diff --git a/python/images/3.jpg b/python/images/3.jpg new file mode 100644 index 0000000..62e2f61 Binary files /dev/null and b/python/images/3.jpg differ diff --git a/python/images/4.jpg b/python/images/4.jpg new file mode 100644 index 0000000..604af82 Binary files /dev/null and b/python/images/4.jpg differ diff --git a/python/images/5.jpg b/python/images/5.jpg new file mode 100644 index 0000000..7ee4423 Binary files /dev/null and b/python/images/5.jpg differ