32 lines
1.1 KiB
Python
32 lines
1.1 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'''
|
|
cd /opt/douyinWEB/backend
|
|
./.venv/bin/python - <<'PY'
|
|
from app import db
|
|
# restore auto relay for operator testing; leave timeslot_test as-is
|
|
db.update_settings_map({"youtube_relay_enabled": True})
|
|
cfg=db.get_settings_map()
|
|
print("relay", cfg.get("youtube_relay_enabled"), "test", cfg.get("youtube_relay_timeslot_test"), "gid", cfg.get("youtube_relay_timeslot_test_group_id"))
|
|
# final studio scrape
|
|
import subprocess, json
|
|
raw=subprocess.check_output(
|
|
["docker","exec","-i","douyinweb-neko-7","python3","-"],
|
|
input=open("/opt/douyinWEB/backend/neko/cdp_studio_scrape.py","rb").read(),
|
|
timeout=30,
|
|
)
|
|
line=raw.decode().strip().splitlines()[-1]
|
|
d=json.loads(line)
|
|
print("final_studio", {k:d.get(k) for k in ("live_status","on_air","health","url")})
|
|
PY
|
|
'''
|
|
_, o, e = c.exec_command(cmd, timeout=60)
|
|
print((o.read()+e.read()).decode("utf-8","replace"))
|
|
c.close()
|