42 lines
1.5 KiB
Python
42 lines
1.5 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)
|
|
|
|
cmd = r'''
|
|
set -euo pipefail
|
|
echo '=== curl cdp ==='
|
|
docker exec douyinweb-neko-7 curl -fsS --max-time 5 http://127.0.0.1:9222/json/list | python3 -c '
|
|
import sys,json
|
|
tabs=json.load(sys.stdin)
|
|
print("count", len(tabs))
|
|
for t in tabs:
|
|
print(t.get("type"), "|", (t.get("title") or "")[:60], "|", (t.get("url") or "")[:140])
|
|
'
|
|
echo '=== assign which group is neko 7 ==='
|
|
cd /opt/douyinWEB/backend
|
|
./.venv/bin/python - <<'PY'
|
|
from app import yt_assign_db, db, youtube_relay_db
|
|
for g in yt_assign_db.list_groups(include_urls=False):
|
|
if int(g.get("neko_instance_id") or 0)==7:
|
|
st=youtube_relay_db.get_relay_state(g["id"]) or {}
|
|
print(dict(name=g.get("name"), id=g.get("id"), channel_pk=g.get("channel_pk"),
|
|
category=g.get("category"), prefer=g.get("neko_open_prefer"),
|
|
relay=st.get("status"), src=st.get("source_url")))
|
|
cfg=db.get_settings_map()
|
|
print("relay_enabled", cfg.get("youtube_relay_enabled"),
|
|
"test", cfg.get("youtube_relay_timeslot_test"),
|
|
"test_gid", cfg.get("youtube_relay_timeslot_test_group_id"))
|
|
PY
|
|
echo '=== ffmpeg ==='
|
|
ps aux | grep -i ffmpeg | grep -v grep | head -5 || true
|
|
'''
|
|
_, o, e = c.exec_command(cmd, timeout=60)
|
|
print((o.read()+e.read()).decode("utf-8","replace"))
|
|
c.close()
|