This captures the current live stack updates across the API, Linux service scripts, tests, diagnostics, and exported console assets so the Ubuntu deployment can pull a consistent test3 build. Co-authored-by: Cursor <cursoragent@cursor.com>
63 lines
2.1 KiB
Python
63 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|
import paramiko, sys, base64, re
|
|
|
|
HOST, USER, PASS = "10.88.0.3", "eric", "Xiao4669805"
|
|
REMOTE = r'''
|
|
import re
|
|
path = "/root/.pm2/logs/youtube-out.log"
|
|
with open(path, "r", errors="replace") as f:
|
|
lines = f.readlines()
|
|
|
|
def parse(ln):
|
|
if "正在录制 1" not in ln or "[原画" not in ln:
|
|
return None
|
|
try:
|
|
after = ln.split("正在录制 1", 1)[1]
|
|
name = after.split("[原画", 1)[0].strip(" :?")
|
|
dur = after.split("[原画", 1)[1].split("]", 1)[0].strip()
|
|
parts = ln.split("|")
|
|
local_t = parts[-2].strip()
|
|
if not re.match(r"\d{2}:\d{2}:\d{2}", local_t):
|
|
return None
|
|
return local_t, name, dur
|
|
except Exception:
|
|
return None
|
|
|
|
targets = ["又系", "樱桃", "钟楼", "橙堡", "伟利", "李泽宇", "小翻翻"]
|
|
for target in targets:
|
|
first=None; last=None; hit205=None
|
|
for ln in lines:
|
|
if '2026-06-24' not in ln: continue
|
|
p=parse(ln)
|
|
if not p: continue
|
|
lt,name,dur=p
|
|
if target not in name: continue
|
|
if first is None: first=(lt,dur,name)
|
|
last=(lt,dur,name)
|
|
if hit205 is None and dur.startswith('2:05'):
|
|
hit205=(lt,dur,name)
|
|
print('\nTARGET', target)
|
|
print(' first', first)
|
|
print(' 2:05 ', hit205)
|
|
print(' last ', last)
|
|
|
|
# detect switches by first 0:00:xx duration
|
|
print('\n=== session starts (dur < 0:02:00) ===')
|
|
for ln in lines:
|
|
if '2026-06-24' not in ln: continue
|
|
p=parse(ln)
|
|
if not p: continue
|
|
lt,name,dur=p
|
|
if dur.startswith('0:00') or dur.startswith('0:01'):
|
|
if any(t in name for t in targets):
|
|
print(lt, dur, name)
|
|
'''
|
|
b64 = base64.b64encode(REMOTE.encode()).decode()
|
|
cmd = f"echo {PASS} | sudo -S python3 -c \"import base64; exec(base64.b64decode('{b64}').decode())\""
|
|
c = paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(HOST, username=USER, password=PASS, timeout=15)
|
|
_, o, e = c.exec_command(cmd, timeout=180, get_pty=True)
|
|
out = (o.read() + e.read()).decode("utf-8", "replace")
|
|
c.close()
|
|
sys.stdout.buffer.write(out.encode("utf-8", "replace"))
|