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>
74 lines
2.8 KiB
Python
74 lines
2.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
import paramiko
|
|
|
|
HOST = "108.174.50.68"
|
|
PASS = "Xiao4669805"
|
|
|
|
REMOTE = r'''
|
|
cd /opt/douyinWEB/backend
|
|
.venv/bin/python <<'PY'
|
|
from app.db import init_db, get_settings_map
|
|
from app import yt_assign_db, youtube_relay_pipeline, youtube_neko, youtube_relay_db, db
|
|
from app.youtube_relay_pipeline import pick_source_for_group, _group_in_active_slot, _live_room_ids
|
|
|
|
init_db()
|
|
cfg = get_settings_map()
|
|
print("relay_enabled", cfg.get("youtube_relay_enabled"))
|
|
print("time_slot", cfg.get("youtube_relay_time_slot_mode"))
|
|
print("exclusive", cfg.get("youtube_relay_exclusive_live"))
|
|
print("dy_cookie_len", len(str(cfg.get("dy_cookie") or "")))
|
|
|
|
pipe = youtube_relay_pipeline.youtube_relay_pipeline
|
|
st = pipe.status()
|
|
print("pipeline_running", st.get("running"), "task", bool(pipe._task and not pipe._task.done()))
|
|
print("pushing", st.get("pushing_count"), "manual_hold", list(pipe._manual_hold))
|
|
print("douyin_live_count", st.get("douyin_live_count"), "live_ids", sorted(list(_live_room_ids()))[:5])
|
|
|
|
groups = yt_assign_db.list_groups(featured_only=True)
|
|
for g in groups:
|
|
gid = str(g.get("id") or "")
|
|
keyed = bool(g.get("has_stream_key") or str(g.get("stream_key") or "").strip())
|
|
if not keyed and not g.get("enabled"):
|
|
continue
|
|
print("---")
|
|
print("name", g.get("name"), "en", g.get("enabled"), "keyed", keyed, "neko", g.get("neko_instance_id"), "neko_en", g.get("neko_enabled"))
|
|
print("in_slot", _group_in_active_slot(gid, keyed_only=True))
|
|
src = pick_source_for_group(g, respect_schedule=True, time_slot_mode=True)
|
|
print("src", src)
|
|
rs = youtube_relay_db.get_relay_state(gid) or {}
|
|
print("relay", rs.get("status"), "|", str(rs.get("error") or "")[:160])
|
|
log = rs.get("recent_log") or []
|
|
if isinstance(log, str):
|
|
import json
|
|
try:
|
|
log = json.loads(log)
|
|
except Exception:
|
|
log = [log]
|
|
for line in (log[-10:] if isinstance(log, list) else []):
|
|
print(" log", str(line)[:180])
|
|
|
|
max_n = max((int(g.get("neko_instance_id") or 0) for g in groups), default=0)
|
|
for inst in youtube_neko.list_instances(max_n, check_http=False):
|
|
print("neko", inst.get("id"), "run", inst.get("running"), "ready", inst.get("ready"), inst.get("status"))
|
|
PY
|
|
'''
|
|
|
|
|
|
def main() -> None:
|
|
import sys
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(HOST, 22, "root", PASS, timeout=45, allow_agent=False, look_for_keys=False)
|
|
_, stdout, stderr = c.exec_command(REMOTE, timeout=60)
|
|
print(stdout.read().decode("utf-8", "replace"))
|
|
err = stderr.read().decode("utf-8", "replace")
|
|
if err.strip():
|
|
print("STDERR", err[-2000:])
|
|
c.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|