douyinWEB/scripts/_diag_slot_dup.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
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>
2026-09-04 22:42:40 -05:00

45 lines
2.2 KiB
Python

# -*- coding: utf-8 -*-
import json, sys, paramiko
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/assign/schedule' -o /tmp/sch.json
curl -sS -b /tmp/dy.ck 'https://dy.nomadro.live/api/youtube/assign/groups' -o /tmp/gr.json
python3 <<'PY'
import json
from pathlib import Path
sch = json.loads(Path('/tmp/sch.json').read_text())
gr = json.loads(Path('/tmp/gr.json').read_text())
print('time_slot_mode', sch.get('time_slot_mode'))
print('channel_count', sch.get('channel_count'), 'slot_hours', sch.get('slot_hours'))
print('now_label', sch.get('now_label'))
print('--- schedule channels ---')
for ch in sch.get('channels') or []:
print(ch.get('start_label'), '-', ch.get('end_label'), '|', ch.get('name'), '| gid', (ch.get('group_id') or '')[:8], '| active', ch.get('active'), '| neko', ch.get('neko_instance_id'))
print(' channel_pk', (ch.get('channel_pk') or '')[:8], 'yt', (ch.get('youtube_channel_id') or '')[:20])
print('--- all assign groups (keyed) ---')
for g in gr.get('groups') or []:
sk = bool(str(g.get('stream_key') or '').strip())
if not sk and not g.get('enabled'):
continue
print(g.get('name'), 'id', g.get('id')[:8], 'neko', g.get('neko_instance_id'), 'pk', (g.get('channel_pk') or '')[:8], 'enabled', g.get('enabled'), 'has_key', sk)
PY
cd /opt/douyinWEB/backend && .venv/bin/python3 <<'PY'
from app import yt_assign_db
for gid in ['6c42de20-1577-40c4-bd7b-c2cf0005dd77','1cc3e3f0-02cf-4216-9780-d5015f338a6e']:
g=yt_assign_db.get_group(gid, include_secret=True) or {}
sk=str(g.get('stream_key') or '')
print('GROUP', g.get('name'), g.get('id'))
print(' neko', g.get('neko_instance_id'), 'yt', g.get('youtube_channel_id'))
print(' key_same_prefix', sk[:12] if sk else 'NONE')
PY
"""
_, o, _ = c.exec_command(REMOTE, timeout=90)
print(o.read().decode())
c.close()