43 lines
1.6 KiB
Python
43 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
import json
|
|
import paramiko
|
|
import sys
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
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)
|
|
|
|
REMOTE = r"""
|
|
curl -sS -c /tmp/dy.ck -X POST https://dy.nomadro.live/api/auth/login \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{"username":"hackrobot","password":"Xiao4669805@"}' >/dev/null
|
|
curl -sS -b /tmp/dy.ck https://dy.nomadro.live/api/youtube/relay/status -o /tmp/r.json
|
|
python3 <<'PY'
|
|
import json
|
|
from pathlib import Path
|
|
d=json.loads(Path('/tmp/r.json').read_text())
|
|
print('slot', d.get('settings',{}).get('youtube_relay_time_slot_mode'))
|
|
print('studio_live', d.get('studio_live'))
|
|
print('pushing', d.get('pushing_count'))
|
|
for ch in (d.get('schedule') or {}).get('channels') or []:
|
|
if ch.get('active'):
|
|
print('ACTIVE', ch.get('name'), ch.get('start_label'), '-', ch.get('end_label'))
|
|
for g in d.get('groups',[]):
|
|
st=str(g.get('status') or '')
|
|
if g.get('is_pushing') or st in ('starting','waiting','pushing') or '大师兄' in str(g.get('name','')) or 'Evan' in str(g.get('name','')):
|
|
print('---', g.get('name'), st, g.get('business_status'), 'push', g.get('is_pushing'))
|
|
if g.get('error'): print(' err', str(g.get('error'))[:120])
|
|
rl=g.get('recent_log')
|
|
if isinstance(rl,list):
|
|
for line in rl[-4:]:
|
|
print(' ', line[:180])
|
|
PY
|
|
ps aux | grep -E '[f]fmpeg.*live2' | wc -l
|
|
"""
|
|
|
|
_, o, _ = c.exec_command(REMOTE, timeout=90)
|
|
print(o.read().decode())
|
|
c.close()
|