艺术动画skill:35种艺术风格、9种解说语法,用代码让画动起来。
JavaScript agent-skillsanimationclaude-codeclaude-code-skillsclaude-skillscodexexplainer-videogenerative-arthuashu-skillsmotion-graphicsskillsvideo
门禁:短于 20 秒的片段红灯降为黄灯只提示(标定集都是 45 秒以上成片)
alchain425f0aa874de
diff --git a/scripts/film_gate.py b/scripts/film_gate.pyindex 58dbec0..689e140 100644--- a/scripts/film_gate.py+++ b/scripts/film_gate.py@@ -503,14 +503,20 @@ def template_similarity(F, shots, template):# ---------------------------------------------------------------- 打灯+SHORT_S = float(os.environ.get("FILM_GATE_MIN_S", 20)) # 标定集都是 45 秒以上的成片;短于这个时长的片段读数噪声大,红灯降为黄灯只提示++def grade(res):rows, red = [], False+ short = (res.get("duration_s") or 0) < SHORT_Sfor k, (name, direc, y, r, gate, unit) in METRICS.items():v = res.get(k)if v is None or direc == "info":rows.append((k, name, v, "--", gate, unit)); continuebad = (lambda t: v >= t) if direc == "high_bad" else (lambda t: v <= t)lv = "red" if (gate and r is not None and bad(r)) else "yellow" if (y is not None and bad(y)) else "green"+ if lv == "red" and short:+ lv = "yellow"; res["short_clip_note"] = f"片长 {res.get('duration_s')}s,短于 {SHORT_S}s,门禁只提示不拦;拼进成片后在成片上再跑一次"red |= lv == "red"rows.append((k, name, v, lv, gate, unit))return rows, red@@ -550,6 +556,8 @@ def explain(res):head = f"镜头内的快速动作偏少({fr:.1%},黄线 6%),离翻页感不远"else:head = f"镜头内有足够的快速动作({fr:.1%})"+ if res.get("short_clip_note"):+ head += "。" + res["short_clip_note"]why = []if lv != "green":if res["slow_zoom_share"] >= 0.3:diff --git a/tests/test_film_gate.py b/tests/test_film_gate.pyindex 15d0caa..5d5aad9 100644--- a/tests/test_film_gate.py+++ b/tests/test_film_gate.py@@ -6,6 +6,8 @@测试只在本机装了 uv、ffmpeg 和 Playwright Chromium 时跑(CI 的媒体契约任务没有这些,自动跳过)。测试用的语法文件写在临时复制的引擎里,不进仓库。"""+import os+os.environ["FILM_GATE_MIN_S"] = "0" # 合成片只有 9 秒;这里测判定本身,不测短片降级import jsonimport osimport shutil@@ -110,6 +112,14 @@ class FilmGateTests(unittest.TestCase):self.assertGreaterEqual(res['fast_ratio'], 0.06)self.assertIsNone(res['explain']['fix'])+ def test_short_clip_only_warns(self):+ # 短于 20 秒的片段读数没标定过:同一支慢推片默认只亮黄灯、不拦+ env = dict(os.environ, FILM_GATE_MIN_S='20')+ r = subprocess.run(['uv', 'run', '--quiet', str(SCRIPTS / 'film_gate.py'), str(W['slow'] / 'slow.mp4'), '--no-template'],+ capture_output=True, text=True, timeout=900, env=env)+ self.assertEqual(r.returncode, 0, r.stdout + r.stderr)+ self.assertIn('只提示不拦', r.stdout)+def test_unreadable_file_exits_1(self):bad = Path(W['tmp'].name) / 'bad.mp4'bad.write_bytes(b'not a video')