# -*- coding: utf-8 -*- from __future__ import annotations import sys import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False) def run(cmd: str, timeout: int = 60) -> str: _, out, err = c.exec_command(cmd, timeout=timeout) return (out.read() + err.read()).decode("utf-8", "replace").strip() print( run( r""" cd /opt/douyinWEB && /opt/douyinWEB/backend/.venv/bin/python <<'PY' from backend.app import db from backend.app import x_clips_db from backend.app.x_clips_pipeline import _room_eligible, sample_live_now, try_sample_live_rooms from backend.app.timeutil import push_date_from_ts import time cfg = db.get_settings_map() keys = [ 'x_clips_enabled','x_clips_live_sample','x_clips_sample_any_live','x_clips_trigger','x_clips_tag', 'x_clips_dedupe_room_day','x_clips_daily_max','x_clips_live_sample_batch','x_clips_account_username' ] for k in keys: print(k, '=', repr(cfg.get(k))) day = push_date_from_ts(time.time()) print('day', day, 'quota_gap', x_clips_db.x_clips_quota_gap(day, cfg), 'used', x_clips_db.x_clips_quota_used(day)) rooms = db.list_live_douyin_rooms_for_shorts(limit=400) print('live_count', len(rooms)) any_live = bool(cfg.get('x_clips_sample_any_live', True)) elig = 0 dedupe = 0 for room in rooms[:30]: rid = str(room.get('room_id') or '') tags = room.get('tags') has = x_clips_db.has_x_clip_job_for_room_day(rid, day) if rid else False ok = any_live or _room_eligible(room, cfg) if has: dedupe += 1 if ok and not has: elig += 1 print(' room', rid, 'tags', tags, 'eligible', ok, 'deduped', has, 'anchor', (room.get('last_anchor') or room.get('last_title') or '')[:20]) print('eligible_not_deduped_sample30', elig, 'deduped_sample30', dedupe) print('sample_live_now', sample_live_now()) PY """ ) ) c.close()