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>
46 lines
1.9 KiB
Python
46 lines
1.9 KiB
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import annotations
|
|
import sys
|
|
import paramiko
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
SCRIPT = r"""
|
|
from app import db, yt_assign_db
|
|
from app.youtube_relay_pipeline import youtube_relay_pipeline as pipe, _group_in_active_slot
|
|
import inspect, asyncio
|
|
|
|
db.init_db()
|
|
cfg = db.get_settings_map()
|
|
print('cookie_len', len(str(cfg.get('dy_cookie') or '')))
|
|
print('cookie_keys', [k for k in cfg if 'cookie' in k.lower() or 'douyin' in k.lower()][:20])
|
|
|
|
# schedule fields
|
|
groups = yt_assign_db.list_groups(include_urls=False, include_secret=True)
|
|
sched = yt_assign_db.build_rotation_schedule(include_urls=False, groups=groups, keyed_only=True)
|
|
print('sched_keys', list(sched.keys()))
|
|
for ch in sched.get('channels') or []:
|
|
print('CH', {k: ch.get(k) for k in ch if k not in ('urls','featured')})
|
|
|
|
for g in groups:
|
|
if not (str(g.get('stream_key') or '').strip() or g.get('has_stream_key')):
|
|
continue
|
|
print('in_slot_check', g.get('name'), _group_in_active_slot(g, keyed_only=True), 'id', g.get('id'))
|
|
|
|
# why not running?
|
|
print('task', pipe._task, 'done', pipe._task.done() if pipe._task else None)
|
|
# try start
|
|
asyncio.get_event_loop().run_until_complete(pipe.start())
|
|
print('after_start running', bool(pipe._task and not pipe._task.done()))
|
|
print('status', pipe.status().get('running'), pipe.status().get('enabled'))
|
|
"""
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("108.174.50.68", 22, "root", "Xiao4669805", timeout=45, allow_agent=False, look_for_keys=False)
|
|
sftp = c.open_sftp()
|
|
with sftp.file("/tmp/_diag_slot2.py", "w") as f:
|
|
f.write(SCRIPT)
|
|
sftp.close()
|
|
_, o, e = c.exec_command("cd /opt/douyinWEB/backend && PYTHONPATH=. .venv/bin/python /tmp/_diag_slot2.py 2>&1", timeout=90)
|
|
print(o.read().decode("utf-8", "replace"))
|
|
print(e.read().decode("utf-8", "replace")[-500:])
|
|
c.close()
|