Clarify Shorts/yt-long quota UI: enabled channels only.

Document fleet-cap rule and drop hardcoded「未达 9 条」copy on Shorts ops cards.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
eric 2026-09-16 21:58:53 -05:00
parent 054fc1139d
commit c042320ef1
4 changed files with 103 additions and 3 deletions

View File

@ -416,6 +416,10 @@ Windows 上可用 `python scripts\_deploy.py`(需自行配置 SSH 目标,**
长视频后台 `reconcile_yt_long_upload_caps` **不得**把操作员保存的上限强行改回 5;仅在 API 限流日对「高于有效上限」的频道做软封顶。
#### 配额口径(Shorts / 长视频)
控制台顶部「北京日配额 / YouTube 上传 / 母片录制」**只合计已启用**频道(停用的 Client B 等不计入)。后端缺口与取样同样只看 `enabled=1`。长视频母片上限 = 已启用 oauth 长视频频道 × 每频道日上限,**不再**按 Shorts 舰队规模抬高。
#### YouTube 直播状态(receiving-first)
首页 / live-map / 转播门控:**优先** YouTube 是否在收流(Studio receiving / `on_air` / youtubei·OAuth `is_live`),Neko 上下线不得覆盖「已在收流」。`encoder_lost` / LIVE 计时器 + No data **不算** receiving。细则见 `.cursor/rules/youtube-live-receiving-first.mdc`。

View File

@ -978,8 +978,14 @@ export default function ShortsPage() {
<>
<div className="mb-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-5">
{[
["北京日配额", `${totals.uploaded} / ${totals.cap || "—"}`, beijingWindow ? `${beijingWindow}(北京时间)` : "按各频道日上限合计"],
["当日缺口", String(totals.gap || quotaGap), minUnmet > 0 ? `${minUnmet} 个频道未达 9 条` : "各频道已达 9 条"],
["北京日配额", `${totals.uploaded} / ${totals.cap || "—"}`, beijingWindow ? `${beijingWindow}(北京时间)· 仅已启用` : "仅已启用频道日上限合计"],
[
"当日缺口",
String(totals.gap || quotaGap),
minUnmet > 0
? `${minUnmet} 个启用频道未达每日最少`
: "启用频道已达每日最少",
],
["已上传", String(totals.uploaded), `待传 ${totals.queuedUpload} · 待录 ${totals.pendingRecord} · 剩余 ${hoursLeft}`],
[
"抖音在播源",

View File

@ -587,7 +587,7 @@ export default function YtLongPage() {
<DailyQuotaGlobalCard
accent="amber"
title="长视频 · 每频道每日上限"
subtitle="全局默认写入「每频道每日上限」;可一键同步到全部长视频频道。母片/总上传上限仍由系统按频道数推算。"
subtitle="全局默认写入「每频道每日上限」;可一键同步到全部长视频频道。母片/总上传上限 = 已启用且已授权频道 × 每频道上限。"
showMin={false}
dailyMin={0}
dailyMax={Number(settings.yt_long_channel_daily_max ?? status?.channel_daily_max ?? 5)}

View File

@ -0,0 +1,90 @@
# -*- coding: utf-8 -*-
"""Redeploy Shorts + yt-long UI quota copy fixes to both VPS."""
from __future__ import annotations
import sys
import time
from pathlib import Path
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
ROOT = Path(__file__).resolve().parents[1]
PASS = "Xiao4669805"
JUMP = "107.173.30.245"
DY = "108.174.50.68"
SH = r'''
set -e
install -D -m 644 /tmp/_q2_shorts.tsx /opt/douyinWEB/frontend/src/app/shorts/page.tsx
install -D -m 644 /tmp/_q2_ytlong.tsx /opt/douyinWEB/frontend/src/app/yt-long/page.tsx
cd /opt/douyinWEB/frontend && npm run build 2>&1 | tail -12
systemctl restart douyinweb-web
sleep 2
systemctl is-active douyinweb-web
# verify enabled-only caps via API status fields
cd /opt/douyinWEB/backend && .venv/bin/python - <<'PY'
from app import db, yt_long_db
from app.timeutil import push_date_from_ts
import time
day = push_date_from_ts(time.time())
se = [c for c in (db.list_shorts_channels(enabled=True) or []) if c.get("enabled")]
print("shorts_en", len(se), "cap", sum(int(c.get("daily_max") or 9) for c in se), "gap", db.shorts_total_quota_gap(day))
print("yt_long_cap", yt_long_db.yt_long_enabled_upload_cap(), "src", yt_long_db.yt_long_source_daily_max(), "gap", yt_long_db.yt_long_source_gap(day))
PY
echo HOST_DONE
'''
def wait(c, path, rounds=100):
out = ""
for i in range(rounds):
time.sleep(3)
_, o, _ = c.exec_command(f"tail -c 16000 {path} 2>/dev/null", timeout=15)
out = o.read().decode("utf-8", "replace")
if "HOST_DONE" in out and "EXIT:" in out:
return out
if i % 5 == 0:
print("poll", i, out[-120:].replace("\n", " | "), flush=True)
return out
def main() -> int:
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(JUMP, 22, "root", PASS, timeout=40, allow_agent=False, look_for_keys=False)
sftp = c.open_sftp()
for local, remote in (
("frontend/src/app/shorts/page.tsx", "/tmp/_q2_shorts.tsx"),
("frontend/src/app/yt-long/page.tsx", "/tmp/_q2_ytlong.tsx"),
):
data = (ROOT / local).read_bytes().replace(b"\r\n", b"\n")
with sftp.file(remote, "wb") as f:
f.write(data)
print("staged", local, len(data), flush=True)
with sftp.file("/tmp/_q2.sh", "w") as f:
f.write(SH)
sftp.close()
print("===== dylive =====", flush=True)
c.exec_command(
"bash /tmp/_q2.sh > /tmp/_q2_dylive.out 2>&1; echo EXIT:$? >> /tmp/_q2_dylive.out",
timeout=1,
)
print(wait(c, "/tmp/_q2_dylive.out")[-8000:], flush=True)
print("===== dy =====", flush=True)
c.exec_command(
f"SSHPASS={PASS} sshpass -e scp -o StrictHostKeyChecking=no "
f"/tmp/_q2_shorts.tsx /tmp/_q2_ytlong.tsx /tmp/_q2.sh root@{DY}:/tmp/ && "
f"SSHPASS={PASS} sshpass -e ssh -o StrictHostKeyChecking=no root@{DY} "
f"'bash /tmp/_q2.sh' > /tmp/_q2_dy.out 2>&1; echo EXIT:$? >> /tmp/_q2_dy.out",
timeout=1,
)
print(wait(c, "/tmp/_q2_dy.out")[-8000:], flush=True)
c.close()
return 0
if __name__ == "__main__":
raise SystemExit(main())