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>
67 lines
2.2 KiB
Python
67 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Resolve current ffmpeg stream to douyin room; check runtime status files."""
|
|
from __future__ import annotations
|
|
|
|
import paramiko
|
|
|
|
HOST, USER, PASS = "10.88.0.3", "eric", "Xiao4669805"
|
|
REMOTE = r'''
|
|
import os, json, subprocess, re, sys
|
|
sys.path.insert(0, "/opt/live/d2ypp")
|
|
os.chdir("/opt/live/d2ypp")
|
|
|
|
def run(cmd):
|
|
return subprocess.check_output(cmd, shell=True, text=True, errors='replace')
|
|
|
|
# runtime status from API internals
|
|
import urllib.request
|
|
for url in [
|
|
"http://127.0.0.1:8001/process_monitor?family=youtube",
|
|
"http://127.0.0.1:8001/status?process=youtube",
|
|
"http://127.0.0.1:8001/process_status?process=youtube",
|
|
]:
|
|
try:
|
|
print("===", url, "===")
|
|
print(urllib.request.urlopen(url, timeout=15).read().decode()[:4000])
|
|
except Exception as e:
|
|
print("ERR", e)
|
|
|
|
# find runtime json under config/data
|
|
for root, dirs, files in os.walk("/opt/live/d2ypp"):
|
|
for fn in files:
|
|
if fn.endswith('.json') and any(x in fn.lower() for x in ['runtime','status','source','relay','ffmpeg']):
|
|
fp=os.path.join(root, fn)
|
|
print('===', fp, '===')
|
|
print(open(fp, errors='replace').read()[:3000])
|
|
|
|
# try resolve room from pull url anchor
|
|
ff = run("ps aux | grep 'ffmpeg.*rtmps' | grep -v grep | head -1")
|
|
print('ffmpeg', ff[:500])
|
|
m = re.search(r'unique_id=([^&\s]+)', ff)
|
|
if m:
|
|
print('unique_id', m.group(1))
|
|
|
|
# grep youtube.py status file
|
|
for p in ["/opt/live/d2ypp/.runtime/youtube.json", "/opt/live/d2ypp/runtime/youtube.json", "/tmp/youtube_status.json"]:
|
|
if os.path.exists(p):
|
|
print('===', p, '===')
|
|
print(open(p).read()[:4000])
|
|
|
|
# list .runtime / .process_runner
|
|
for d in ["/opt/live/d2ypp/.runtime", "/opt/live/d2ypp/.process_runner", "/opt/live/d2ypp/data"]:
|
|
if os.path.isdir(d):
|
|
print('DIR', d, os.listdir(d))
|
|
'''
|
|
|
|
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())[:25000])
|
|
c.close()
|
|
|
|
if __name__ == "__main__":
|
|
main()
|