Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP. Co-authored-by: Cursor <cursoragent@cursor.com>
69 lines
2.4 KiB
Python
69 lines
2.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
import sys
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False)
|
|
|
|
|
|
def run(cmd: str, timeout: int = 90) -> str:
|
|
_, o, e = c.exec_command(cmd, timeout=timeout)
|
|
return (o.read() + e.read()).decode("utf-8", "replace").strip()
|
|
|
|
|
|
print("=== ffmpeg ===")
|
|
print(run("ps aux | grep ffmpeg | grep -v grep | head -20"))
|
|
print("=== which ffmpeg ===")
|
|
print(run("which ffmpeg; ffmpeg -version 2>&1 | head -2"))
|
|
print("=== relay settings ===")
|
|
print(
|
|
run(
|
|
"cd /opt/douyinWEB/backend && python3 - <<'PY'\n"
|
|
"from app import db\n"
|
|
"m=db.get_settings_map()\n"
|
|
"keys=[k for k in m if 'youtube_relay' in k or k=='douyin_cookie']\n"
|
|
"for k in sorted(keys):\n"
|
|
" v=m.get(k)\n"
|
|
" if k=='douyin_cookie':\n"
|
|
" print(k, 'len=', len(str(v or '')))\n"
|
|
" else:\n"
|
|
" print(k, '=', v)\n"
|
|
"PY"
|
|
)
|
|
)
|
|
print("=== relay states ===")
|
|
print(
|
|
run(
|
|
"cd /opt/douyinWEB/backend && python3 - <<'PY'\n"
|
|
"import json\n"
|
|
"from app import youtube_relay_db as d\n"
|
|
"rows=d.list_relay_states()\n"
|
|
"print(json.dumps(rows, ensure_ascii=False, indent=2)[:4000])\n"
|
|
"PY"
|
|
)
|
|
)
|
|
print("=== groups schedule snippet ===")
|
|
print(
|
|
run(
|
|
"cd /opt/douyinWEB/backend && python3 - <<'PY'\n"
|
|
"import json\n"
|
|
"from app import yt_assign_db\n"
|
|
"s=yt_assign_db.build_rotation_schedule(include_urls=False)\n"
|
|
"print('now', s.get('now_label'))\n"
|
|
"for ch in (s.get('channels') or []):\n"
|
|
" print(ch.get('name'), 'active=', ch.get('active'), ch.get('start_label'), '-', ch.get('end_label'), 'gid=', ch.get('group_id'))\n"
|
|
"gs=yt_assign_db.list_groups(include_urls=True)\n"
|
|
"for g in gs:\n"
|
|
" feat=g.get('featured') or []\n"
|
|
" print('G', g.get('name'), 'enabled', g.get('enabled'), 'key', bool(g.get('stream_key')), 'featured', len(feat))\n"
|
|
" for f in feat[:3]:\n"
|
|
" print(' ', f.get('title'), f.get('url'), 'room', f.get('room_id'))\n"
|
|
"PY"
|
|
)
|
|
)
|
|
print("=== journal ===")
|
|
print(run("journalctl -u douyinweb-api -n 50 --no-pager"))
|
|
c.close()
|