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>
54 lines
2.1 KiB
Python
54 lines
2.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import annotations
|
|
import sys
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
CMD = r"""
|
|
# find live youtube ffmpeg and inspect audio-related args + recent progress
|
|
FF=$(ps -eo pid,cmd | awk '/ffmpeg/ && /rtmps.youtube/ {print; exit}')
|
|
echo "FF_LINE=$FF"
|
|
PID=$(ps -eo pid,cmd | awk '/ffmpeg/ && /rtmps.youtube/ {print $1; exit}')
|
|
echo "PID=$PID"
|
|
if [ -n "$PID" ]; then
|
|
tr '\0' ' ' < /proc/$PID/cmdline; echo
|
|
fi
|
|
echo '--- settings ---'
|
|
cd /opt/douyinWEB/backend
|
|
.venv/bin/python <<'PY'
|
|
from app import db, youtube_relay_db, yt_assign_db
|
|
from app.youtube_relay_pipeline import _group_in_active_slot
|
|
from app.youtube_relay import resolve_relay_encoding
|
|
cfg=db.get_settings_map()
|
|
enc=resolve_relay_encoding(cfg)
|
|
print('enc', {k:enc.get(k) for k in ('preset_id','width','height','fps','bitrate_kbps','audio_bitrate_kbps','x264_preset')})
|
|
print('cfg_keys', {k:cfg.get(k) for k in cfg if 'relay' in k.lower() and ('audio' in k.lower() or 'quality' in k.lower() or 'encod' in k.lower() or 'preset' in k.lower())})
|
|
winner=None
|
|
for g in yt_assign_db.list_groups(include_urls=False, include_secret=False):
|
|
if g.get('has_stream_key') and g.get('enabled') and _group_in_active_slot(str(g.get('id')), keyed_only=True):
|
|
winner=g; break
|
|
st=youtube_relay_db.get_relay_state(str(winner['id'])) or {} if winner else {}
|
|
print('status', st.get('status'), 'pid', st.get('ffmpeg_pid'))
|
|
# last log lines mentioning audio/bitrate
|
|
for line in (st.get('recent_log') or [])[-30:]:
|
|
low=str(line).lower()
|
|
if any(x in low for x in ('audio','a:', 'bitrate', 'stream #', 'map', 'aac', 'error', 'warning')):
|
|
print('LOG', line[:200])
|
|
# dump last 5 always
|
|
print('---tail---')
|
|
for line in (st.get('recent_log') or [])[-5:]:
|
|
print(line[:180])
|
|
PY
|
|
"""
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("108.174.50.68", 22, "root", "Xiao4669805", timeout=60, allow_agent=False, look_for_keys=False)
|
|
_, o, e = c.exec_command(CMD, timeout=60)
|
|
print(o.read().decode("utf-8", "replace"))
|
|
err = e.read().decode("utf-8", "replace")
|
|
if err.strip():
|
|
print("STDERR", err[-1500:])
|
|
c.close()
|