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>
77 lines
2.9 KiB
Python
77 lines
2.9 KiB
Python
#!/usr/bin/env python3
|
|
import paramiko
|
|
|
|
HOST, USER, PASS = "10.88.0.3", "eric", "Xiao4669805"
|
|
REMOTE = r'''
|
|
import sqlite3, json, time, re
|
|
from datetime import datetime
|
|
|
|
conn=sqlite3.connect("/opt/live/d2ypp/config/hub_state.sqlite")
|
|
conn.row_factory=sqlite3.Row
|
|
now=time.time()
|
|
# all samples today for youtube process
|
|
start=now-24*3600
|
|
rows=conn.execute(
|
|
"SELECT s.id, s.ts, s.source, s.payload_json, e.id as eid, e.source_room_id "
|
|
"FROM youtube_live_samples s JOIN youtube_live_events e ON e.id=s.event_id "
|
|
"WHERE e.process='youtube' AND s.ts >= ? ORDER BY s.ts",
|
|
(start,),
|
|
).fetchall()
|
|
print('samples today', len(rows))
|
|
for r in rows:
|
|
payload = r['payload_json'] or ''
|
|
if len(payload) < 5:
|
|
continue
|
|
ts = datetime.fromtimestamp(r['ts']).isoformat()
|
|
# look for recording duration in payload
|
|
if '正在录制' in payload or '原画 2:' in payload or '原画 1:' in payload or 'recent_log' in payload:
|
|
print('---', ts, 'event', r['eid'], 'room', r['source_room_id'], '---')
|
|
try:
|
|
p=json.loads(payload)
|
|
log=p.get('recent_log','')
|
|
for line in log.split('\n'):
|
|
if '正在录制' in line:
|
|
print(line[:220])
|
|
except Exception:
|
|
print(payload[:300])
|
|
|
|
# grep ingest payloads around 7am in all samples
|
|
print('\n=== samples 06:00-08:30 with recording line ===')
|
|
t0=datetime(2026,6,24,6,0,0).timestamp()
|
|
t1=datetime(2026,6,24,8,30,0).timestamp()
|
|
rows2=conn.execute(
|
|
"SELECT s.ts, s.payload_json FROM youtube_live_samples s "
|
|
"JOIN youtube_live_events e ON e.id=s.event_id WHERE e.process='youtube' AND s.ts BETWEEN ? AND ?",
|
|
(t0,t1),
|
|
).fetchall()
|
|
print('count', len(rows2))
|
|
for r in rows2:
|
|
p=r['payload_json'] or ''
|
|
if '正在录制' in p:
|
|
ts=datetime.fromtimestamp(r['ts']).isoformat()
|
|
m=re.search(r'正在录制 1 路: ([^\[]+)\[原画 ([0-9:]+)\]', p)
|
|
if m:
|
|
print(ts, m.group(1).strip(), m.group(2))
|
|
|
|
# update event 67 current fields
|
|
r=conn.execute("SELECT source_room_id, source_url, snapshot_json, duration_seconds, started_at FROM youtube_live_events WHERE id=67").fetchone()
|
|
print('\nEVENT67', dict(r))
|
|
conn.close()
|
|
|
|
# pull status log lines with 2:0x duration from ring if stored anywhere
|
|
import urllib.request
|
|
st=json.loads(urllib.request.urlopen('http://127.0.0.1:8001/status?process=youtube', timeout=20).read())
|
|
log=st.get('recent_log','')
|
|
for line in log.split('\n'):
|
|
if '正在录制' in line and '原画 2:' in line:
|
|
print('NOW2H', line)
|
|
'''
|
|
|
|
def main():
|
|
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(f"python3 - <<'PY'\n{REMOTE}\nPY", timeout=90, get_pty=True)
|
|
import sys; sys.stdout.buffer.write((o.read()+e.read())[:40000])
|
|
c.close()
|
|
if __name__=='__main__': main()
|