From 633b0bd184d7750f08f2a20598e06dc006a53bc2 Mon Sep 17 00:00:00 2001 From: Jerry Date: Fri, 31 Mar 2023 00:10:32 +0800 Subject: [PATCH] u --- a.py | 8 ++++++-- bad_apple.py | 8 ++++++-- draw-gen3.py | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/a.py b/a.py index 7cf0bc0..4a1fa7a 100644 --- a/a.py +++ b/a.py @@ -1,3 +1,7 @@ +IN='http://us2.g-load.eu:9090/stream' +OUT='fdcf:8538:9ad5:3333' +IN='http://[fd51:9b17:dc40::2]:9090/stream' +OUT='fd51:9b17:dc40:a55' import argparse parser = argparse.ArgumentParser() parser.add_argument('--skip', type=int, default=0, help="skip x lines (unused)") @@ -112,7 +116,7 @@ def get_bg(): global img while True: try: - with contextlib.closing(urllib.request.urlopen(mkreq('http://us2.g-load.eu:9090/stream'), timeout=timeout)) as resp: + with contextlib.closing(urllib.request.urlopen(mkreq(IN), timeout=timeout)) as resp: for line in resp: if line.startswith(b'data:'): with imglock: @@ -156,7 +160,7 @@ def draw(img): newpix = img.getpixel((x, y)) r, g, b, a = newpix if a and newpix != ldraw.getpixel((x, y)): - send_icmp_q.append(f"fdcf:8538:9ad5:3333:{x:x}:{y:x}:11{r:02x}:{g:02x}{b:02x}") + send_icmp_q.append(f"{OUT}:{x:x}:{y:x}:11{r:02x}:{g:02x}{b:02x}") startsend = time.time() send_icmp(send_icmp_q) ldraw = img.copy() diff --git a/bad_apple.py b/bad_apple.py index 222c03a..c769ae2 100644 --- a/bad_apple.py +++ b/bad_apple.py @@ -1,3 +1,7 @@ +IN='http://us2.g-load.eu:9090/stream' +OUT='fdcf:8538:9ad5:3333' +IN='http://[fd51:9b17:dc40::2]:9090/stream' +OUT='fd51:9b17:dc40:a55' #gen3 import argparse @@ -116,7 +120,7 @@ def get_bg(): global img while True: try: - with contextlib.closing(urllib.request.urlopen(mkreq('http://us2.g-load.eu:9090/stream'), timeout=timeout)) as resp: + with contextlib.closing(urllib.request.urlopen(mkreq(IN), timeout=timeout)) as resp: for line in resp: if line.startswith(b'data:'): with imglock: @@ -156,7 +160,7 @@ def draw(img): if a and newpix != ldraw.getpixel((x, y)): x += X_OFFSET y += Y_OFFSET - send_icmp_q.append(f"fdcf:8538:9ad5:3333:{x:x}:{y:x}:11{r:02x}:{g:02x}{b:02x}") + send_icmp_q.append(f"{OUT}:{x:x}:{y:x}:11{r:02x}:{g:02x}{b:02x}") #startsend = time.time() send_icmp(send_icmp_q) ldraw = img.copy() diff --git a/draw-gen3.py b/draw-gen3.py index ecbd3d9..6947337 100644 --- a/draw-gen3.py +++ b/draw-gen3.py @@ -1,3 +1,7 @@ +IN='http://us2.g-load.eu:9090/stream' +OUT='fdcf:8538:9ad5:3333' +IN='http://[fd51:9b17:dc40::2]:9090/stream' +OUT='fd51:9b17:dc40:a55' #gen3 import argparse @@ -111,7 +115,7 @@ def get_bg(): global img while True: try: - with contextlib.closing(urllib.request.urlopen(mkreq('http://us2.g-load.eu:9090/stream'), timeout=timeout)) as resp: + with contextlib.closing(urllib.request.urlopen(mkreq(IN), timeout=timeout)) as resp: for line in resp: if line.startswith(b'data:'): with imglock: @@ -149,7 +153,7 @@ def draw(img): newpix = img.getpixel((x, y)) r, g, b, a = newpix if a and newpix != ldraw.getpixel((x, y)): - send_icmp_q.append(f"fdcf:8538:9ad5:3333:{x:x}:{y:x}:11{r:02x}:{g:02x}{b:02x}") + send_icmp_q.append(f"{OUT}:{x:x}:{y:x}:11{r:02x}:{g:02x}{b:02x}") startsend = time.time() send_icmp(send_icmp_q) ldraw = img.copy()