Skip to content

zenstory-ai/video-recap-skills / skills/video-recap

video-recap

Verified

把一段或多集视频做成带画框字幕的中文解说成片或纯原声高光短片。用户提供 .mp4 / .mov / .mkv / .webm,要求做影视解说、短剧二创、加旁白配音、跨集混剪或导出剪映草稿时使用;串联完成看片识台词、定主线与留原声、按台词停顿切镜头、写词检查、TTS 配音与混音加字幕。触发词:视频解说、影视解说、视频旁白、生成解说、视频 recap、video recap、voiceover、narration、recap。

FileKindSize
SKILL.mdskill md18.4 KB
assets/dashboard/app.jsscript16.2 KB
assets/dashboard/index.htmlother867 B
assets/dashboard/styles.cssother22.6 KB
assets/dashboard/tokens.cssother8.9 KB
assets/dashboard/views.jsscript31.4 KB
references/audio-modes.mdmarkdown3.6 KB
references/config-playbook.mdmarkdown8.1 KB
references/creative-editing-playbook.mdmarkdown12.3 KB
references/data-schema.mdmarkdown34.6 KB
references/index-tts.mdmarkdown2.1 KB
references/jianying/LICENSE.duo-videoother1.0 KB
references/jianying/SOURCE.mdmarkdown703 B
references/jianying/empty_draft_meta_info.jsonconfig1.7 KB
references/jianying/empty_jy_material_video.jsonconfig1.8 KB
references/jianying/empty_jy_meta_material_value.jsonconfig358 B
references/jianying/empty_jy_project_info.jsonconfig3.6 KB
references/jianying/empty_jy_segment.jsonconfig1.3 KB
references/jianying/empty_jy_text_styles.jsonconfig440 B
references/jianying/empty_yj_material_audio.jsonconfig865 B
references/jianying/empty_yj_material_text.jsonconfig2.4 KB
references/packaging.mdmarkdown6.8 KB
references/promotional-copy.mdmarkdown4.1 KB
references/prompt-templates.mdmarkdown2.0 KB
references/research-guide.mdmarkdown2.7 KB
references/resource-library.mdmarkdown12.1 KB
references/shot-review.mdmarkdown4.8 KB
scripts/agent_text.pyscript2.7 KB
scripts/artifacts.pyscript972 B
scripts/asr.pyscript12.5 KB
scripts/asr_timing_evidence.pyscript4.2 KB
scripts/assemble.pyscript31.0 KB
scripts/assemble_constants.pyscript894 B
scripts/assembly_contract.pyscript10.3 KB
scripts/assembly_settings.pyscript3.8 KB
scripts/audio_automation.pyscript6.6 KB
scripts/audio_mix.pyscript18.5 KB
scripts/briefing/__init__.pyscript101 B
scripts/briefing/builder.pyscript31.1 KB
scripts/briefing/context.pyscript6.1 KB
scripts/briefing/timeline.pyscript23.0 KB
scripts/codec_peak.pyscript5.1 KB
scripts/cut.pyscript148 B
scripts/cut_cli.pyscript12.4 KB
scripts/cut_contract.pyscript13.3 KB
scripts/cut_qc.pyscript1.9 KB
scripts/cut_render.pyscript13.2 KB
scripts/dashboard/__init__.pyscript159 B
scripts/dashboard/data.pyscript24.6 KB
scripts/dashboard/io.pyscript7.1 KB
scripts/dashboard/runs.pyscript21.8 KB
scripts/dashboard/templates.pyscript9.6 KB
scripts/dashboard_server.pyscript9.3 KB
scripts/detect.pyscript22.2 KB
scripts/doctor.pyexecutablescript12.9 KB
scripts/entry_suggestion.pyscript4.6 KB
scripts/export_jianying.pyscript5.6 KB
scripts/extract.pyscript2.5 KB
scripts/final_qc.pyscript19.0 KB
scripts/frame_grid.pyscript10.6 KB
scripts/jianying/__init__.pyscript49 B
scripts/jianying/builders.pyscript11.3 KB
scripts/jianying/model.pyscript2.7 KB
scripts/jianying/optional.pyscript1012 B
scripts/jianying/schema.pyscript2.5 KB
scripts/jianying/templates.pyscript1.0 KB
scripts/jianying/timeline_contract.pyscript5.8 KB
scripts/jianying/tracks.pyscript2.0 KB
scripts/jianying/writer.pyscript7.8 KB
scripts/lib.pyscript29.6 KB
scripts/library.pyscript31.1 KB
scripts/lint_summary.pyscript5.0 KB
scripts/loudness.pyscript14.7 KB
scripts/materials.pyscript22.1 KB
scripts/media.pyscript18.8 KB
scripts/narration_audio.pyscript13.5 KB
scripts/narration_lint.pyscript24.1 KB
scripts/narrative_selection.pyscript8.9 KB
scripts/packaging.pyscript6.1 KB
scripts/packaging_fonts.pyscript12.0 KB
scripts/packaging_plates.pyscript31.2 KB
scripts/packaging_studio.pyscript34.1 KB
scripts/providers/__init__.pyscript72 B
scripts/providers/fish_audio.pyscript3.1 KB
scripts/providers/index_tts.pyscript8.8 KB
scripts/recap.pyscript183 B
scripts/recap_cli.pyscript6.9 KB
scripts/recap_inspect.pyscript16.5 KB
scripts/recap_runner.pyscript22.0 KB
scripts/recap_runtime.pyscript11.8 KB
scripts/recap_source.pyscript1.8 KB
scripts/recap_stage_qc.pyscript2.7 KB
scripts/recap_timeline.pyscript7.7 KB
scripts/render_preflight.pyscript1.7 KB
scripts/resources/__init__.pyscript200 B
scripts/resources/lock.pyscript6.8 KB
scripts/resources/project_binding.pyscript16.1 KB
scripts/sentence_boundaries.pyscript28.8 KB
scripts/sentence_gate.pyscript8.6 KB
scripts/sfx_mix.pyscript14.6 KB
scripts/shot_review.pyscript18.9 KB
scripts/source_subtitles.pyscript7.2 KB
scripts/speech_ownership.pyscript9.3 KB
scripts/storyboard.pyscript21.8 KB
scripts/subtitles/__init__.pyscript56 B
scripts/subtitles/core.pyscript19.0 KB
scripts/subtitles/render.pyscript8.0 KB
scripts/timeline.pyscript8.2 KB
scripts/timeline_emit.pyscript5.4 KB
scripts/tts_audio.pyscript9.6 KB
scripts/tts_cache.pyscript4.5 KB
scripts/understand.pyscript171 B
scripts/understanding_brief.pyscript6.3 KB
scripts/understanding_cache.pyscript8.0 KB
scripts/understanding_runner.pyscript9.8 KB
scripts/understanding_storyboard.pyscript11.9 KB
scripts/validate.pyscript5.7 KB
scripts/visual_render.pyscript10.1 KB
scripts/vlm.pyscript16.4 KB
scripts/voiceover.pyscript28.0 KB

scripts/dashboard/io.py

View on GitHub
"""Path gate, capped JSON reads and marker discovery for the read-only dashboard.

Every request path goes through ``resolve_under``; every artifact read goes through
``read_json`` (size-capped, never raises). ``discover`` walks the dashboard root with a
bounded depth and directory count. Nothing here writes to disk.
"""
from __future__ import annotations

import json
import os
import stat
import re
from collections import deque
from pathlib import Path, PurePosixPath, PureWindowsPath

LIBRARY_FILE = "library.json"
PROJECT_FILE = "recap_project.json"
RUN_FILE = "recap_run_manifest.json"
MARKERS = (LIBRARY_FILE, PROJECT_FILE, RUN_FILE)

MAX_DEPTH = 8
MAX_DIRS = 5000
MAX_JSON_BYTES = 2 * 1024 * 1024
MAX_RAW_CHARS = 20000
MAX_MEDIA_BYTES = 4 * 1024 * 1024 * 1024
SKIP_DIR_NAMES = {"node_modules", "__pycache__"}
MEDIA_TYPES = {
    ".mp4": "video/mp4", ".mov": "video/quicktime", ".webm": "video/webm",
    ".m4a": "audio/mp4", ".wav": "audio/wav", ".mp3": "audio/mpeg",
    ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".webp": "image/webp",
}
VIDEO_EXTS = {".mp4", ".mov", ".webm"}
AUDIO_EXTS = {".m4a", ".wav", ".mp3"}


class Refused(Exception):
    """A request that must not be served; ``status`` is the HTTP code to answer with."""

    def __init__(self, status: int, message: str):
        super().__init__(message)
        self.status = status
        self.message = message


def rel_of(root: Path, path) -> str | None:
    """Root-relative POSIX path of ``path`` after resolving symlinks, or None when outside."""
    try:
        rel = Path(path).resolve().relative_to(root)
    except (ValueError, OSError):
        return None
    return rel.as_posix() or "."


def dir_of(root: Path, rel: str) -> Path:
    return root if rel == "." else root / rel


def resolve_under(root: Path, rel) -> Path:
    """Resolve a root-relative request path; refuse absolute paths, ``..`` and escapes."""
    if not isinstance(rel, str) or not rel or "\0" in rel:
        raise Refused(400, "缺少 path 参数")
    if (PurePosixPath(rel).is_absolute() or PureWindowsPath(rel).is_absolute()
            or PureWindowsPath(rel).drive or rel.startswith(("/", "\\"))):
        raise Refused(403, "只接受 --root 内的相对路径")
    if ".." in re.split(r"[\\/]", rel):
        raise Refused(403, "路径不能包含 ..")
    target = (root / rel).resolve()
    if rel_of(root, target) is None:
        raise Refused(403, "路径解析后不在 --root 内")
    return target


def media_path(root: Path, rel) -> Path:
    """A servable media file: inside root, whitelisted extension, within the size cap."""
    target = resolve_under(root, rel)
    if target.suffix.lower() not in MEDIA_TYPES:
        raise Refused(403, "不支持的媒体类型")
    if not target.is_file():
        raise Refused(404, "文件不存在")
    if target.stat().st_size > MAX_MEDIA_BYTES:
        raise Refused(403, "文件超过大小上限")
    return target


def media_entry(root: Path, path) -> dict | None:
    """``{path, kind, name, size}`` for a previewable file inside root, else None."""
    path = Path(path)
    rel = rel_of(root, path)
    ext = path.suffix.lower()
    if rel is None or ext not in MEDIA_TYPES or not path.is_file():
        return None
    kind = "video" if ext in VIDEO_EXTS else "audio" if ext in AUDIO_EXTS else "image"
    return {"path": rel, "kind": kind, "name": path.name, "size": path.stat().st_size}


def unreadable_reason(path: Path) -> str | None:
    """Why a data file must not be opened: symlinks (they could point outside root) and
    anything that is not a regular file (a FIFO or device would block or never end)."""
    try:
        st = os.lstat(path)
    except OSError as exc:
        return f"无法读取: {exc.strerror or exc}"
    if stat.S_ISLNK(st.st_mode):
        return "是符号链接,未读取"
    if not stat.S_ISREG(st.st_mode):
        return "不是普通文件,未读取"
    if st.st_size > MAX_JSON_BYTES:
        return "文件超过 2 MB,未读取"
    return None


def read_json(path: Path):
    """``(data, None)`` or ``(None, 中文原因)``; never raises, never reads past the cap."""
    reason = unreadable_reason(path)
    if reason:
        return None, reason
    try:
        return json.loads(path.read_text(encoding="utf-8")), None
    except (OSError, ValueError) as exc:
        return None, f"无法解析: {exc}"


def read_object(path: Path):
    data, error = read_json(path)
    if error is None and not isinstance(data, dict):
        return None, "无法解析: 顶层必须是 JSON object"
    return data, error


def raw_text(path: Path) -> str:
    """The start of a file for the "按原文显示" fallback; empty when unreadable."""
    if unreadable_reason(path):
        return ""
    try:
        with path.open("r", encoding="utf-8", errors="replace") as handle:
            text = handle.read(MAX_RAW_CHARS + 1)
    except OSError:
        return ""
    return text if len(text) <= MAX_RAW_CHARS else text[:MAX_RAW_CHARS] + "\n…(已截断)"


def discover(root: Path) -> dict:
    """Breadth-first marker scan: bounded depth and directory count; skips hidden, symlinked
    and dependency directories. Library roots are not descended (``scan_library`` owns them)."""
    found = {marker: [] for marker in MARKERS}
    warnings: list[str] = []
    queue = deque([(root, 0)])
    seen = 0
    depth_cut = False
    while queue:
        directory, depth = queue.popleft()
        seen += 1
        if seen > MAX_DIRS:
            warnings.append(f"目录超过 {MAX_DIRS} 个,扫描已截断;请把 --root 指向更小的目录")
            break
        try:
            with os.scandir(directory) as it:
                entries = list(it)
        except OSError as exc:
            warnings.append(f"无法读取目录 {rel_of(root, directory) or directory}: {exc.strerror or exc}")
            continue
        names = {e.name for e in entries if e.is_file(follow_symlinks=False)}
        rel = directory.relative_to(root).as_posix() or "."
        for marker in MARKERS:
            if marker in names:
                found[marker].append(rel)
        if LIBRARY_FILE in names:
            continue
        for entry in sorted(entries, key=lambda e: e.name):
            if (entry.name.startswith(".") or entry.name in SKIP_DIR_NAMES
                    or entry.is_symlink() or not entry.is_dir(follow_symlinks=False)):
                continue
            if depth >= MAX_DEPTH:
                depth_cut = True
                continue
            queue.append((Path(entry.path), depth + 1))
    if depth_cut:
        warnings.append(f"目录层级超过 {MAX_DEPTH} 层的部分未扫描")
    return {"libraries": found[LIBRARY_FILE], "projects": found[PROJECT_FILE],
            "runs": found[RUN_FILE], "warnings": warnings}


def nearest(rel: str, candidates, include_self=False) -> str | None:
    """The closest ancestor of ``rel`` (optionally ``rel`` itself) that is in ``candidates``."""
    if rel == ".":
        chain = ["."] if include_self else []
    else:
        chain = ([rel] if include_self else []) + [str(p) for p in PurePosixPath(rel).parents]
    return next((c for c in chain if c in candidates), None)
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 196kUpdated Claude CodeCodexVerifiedInstall