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>
108 lines
3.4 KiB
Python
108 lines
3.4 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()
|
|
|
|
pat = re.compile(r"正在录制 1 .: ([^\[]+)\[原画 ([0-9:]+)\].*\| (\d{2}:\d{2}:\d{2}) \|")
|
|
# fallback: split-based parser
|
|
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 len(parts) >= 2 else ""
|
|
if not re.match(r"\d{2}:\d{2}:\d{2}", local_t):
|
|
return None
|
|
return local_t, name, dur, ln.strip()[:220]
|
|
except Exception:
|
|
return None
|
|
|
|
# local time 07:00-07:30 on Jun24 session (any log date)
|
|
print('=== local 07:00-07:30 recordings ===')
|
|
rows=[]
|
|
for ln in lines:
|
|
if '2026-06-24' not in ln and '2026-06-25' not in ln:
|
|
continue
|
|
p=parse(ln)
|
|
if not p: continue
|
|
lt,name,dur,_=p
|
|
h,m,s=map(int,lt.split(':'))
|
|
if h==7 and m<30:
|
|
rows.append((lt,dur,name))
|
|
for r in rows[::15][:40]:
|
|
print(r)
|
|
|
|
# first time each room hits >=2:05:00 today
|
|
print('\n=== first >=2:05:00 per room (local time) ===')
|
|
seen={}
|
|
for ln in lines:
|
|
if '2026-06-24' not in ln: continue
|
|
p=parse(ln)
|
|
if not p: continue
|
|
lt,name,dur,_=p
|
|
parts=dur.split(':')
|
|
if len(parts)==3:
|
|
sec=int(parts[0])*3600+int(parts[1])*60+int(parts[2])
|
|
elif len(parts)==2:
|
|
sec=int(parts[0])*60+int(parts[1])
|
|
else:
|
|
continue
|
|
if sec >= 2*3600+5*60 and name not in seen:
|
|
seen[name]=(lt,dur,ln.strip()[:200])
|
|
for name,v in seen.items():
|
|
print(v[0], v[1], name)
|
|
|
|
# around 12h before 19:20 => 07:20, find closest 2:05 duration line
|
|
print('\n=== lines with duration 2:04-2:06 and local 06:30-08: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 not re.match(r'2:0[4-6]:', dur):
|
|
continue
|
|
h=int(lt.split(':')[0])
|
|
if 6 <= h <= 8:
|
|
print(lt, dur, name)
|
|
|
|
# what was recording at local 07:10 exactly (nearest lines)
|
|
print('\n=== nearest to local 07:10 ===')
|
|
best=[]
|
|
for ln in lines:
|
|
if '2026-06-24' not in ln: continue
|
|
p=parse(ln)
|
|
if not p: continue
|
|
lt,name,dur,_=p
|
|
h,m,s=map(int,lt.split(':'))
|
|
if h==7 and 8<=m<=12:
|
|
best.append((lt,dur,name))
|
|
for r in best[::3]:
|
|
print(r)
|
|
|
|
# room switches: 准备开始录制
|
|
print('\n=== start recording events local 05:00-08:30 ===')
|
|
for ln in lines:
|
|
if '准备开始录制' not in ln and '开始推流到 YouTube' not in ln:
|
|
continue
|
|
if '2026-06-24' not in ln: continue
|
|
# extract anchor from line
|
|
if '2026-06-24T1' in ln or '2026-06-24T0' in ln or '2026-06-25T0' in ln:
|
|
print(ln.strip()[:240])
|
|
'''
|
|
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"))
|