This commit is contained in:
JerryXiao 2023-03-31 00:10:32 +08:00
parent 406ad1da1c
commit 633b0bd184
3 changed files with 18 additions and 6 deletions

8
a.py
View file

@ -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 import argparse
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--skip', type=int, default=0, help="skip x lines (unused)") parser.add_argument('--skip', type=int, default=0, help="skip x lines (unused)")
@ -112,7 +116,7 @@ def get_bg():
global img global img
while True: while True:
try: 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: for line in resp:
if line.startswith(b'data:'): if line.startswith(b'data:'):
with imglock: with imglock:
@ -156,7 +160,7 @@ def draw(img):
newpix = img.getpixel((x, y)) newpix = img.getpixel((x, y))
r, g, b, a = newpix r, g, b, a = newpix
if a and newpix != ldraw.getpixel((x, y)): 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() startsend = time.time()
send_icmp(send_icmp_q) send_icmp(send_icmp_q)
ldraw = img.copy() ldraw = img.copy()

View file

@ -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 #gen3
import argparse import argparse
@ -116,7 +120,7 @@ def get_bg():
global img global img
while True: while True:
try: 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: for line in resp:
if line.startswith(b'data:'): if line.startswith(b'data:'):
with imglock: with imglock:
@ -156,7 +160,7 @@ def draw(img):
if a and newpix != ldraw.getpixel((x, y)): if a and newpix != ldraw.getpixel((x, y)):
x += X_OFFSET x += X_OFFSET
y += Y_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() #startsend = time.time()
send_icmp(send_icmp_q) send_icmp(send_icmp_q)
ldraw = img.copy() ldraw = img.copy()

View file

@ -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 #gen3
import argparse import argparse
@ -111,7 +115,7 @@ def get_bg():
global img global img
while True: while True:
try: 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: for line in resp:
if line.startswith(b'data:'): if line.startswith(b'data:'):
with imglock: with imglock:
@ -149,7 +153,7 @@ def draw(img):
newpix = img.getpixel((x, y)) newpix = img.getpixel((x, y))
r, g, b, a = newpix r, g, b, a = newpix
if a and newpix != ldraw.getpixel((x, y)): 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() startsend = time.time()
send_icmp(send_icmp_q) send_icmp(send_icmp_q)
ldraw = img.copy() ldraw = img.copy()