@oh-story/dsh 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -12
- package/lib/client.js +2707 -268
- package/lib/client.js.map +4 -4
- package/lib/drama/manifest.json +136 -101
- package/lib/drama/skills/short-drama/SKILL.md +61 -1
- package/lib/drama/skills/short-drama/references/contract-and-ownership.md +7 -4
- package/lib/drama/skills/short-drama/references/creator-documents.md +133 -8
- package/lib/drama/skills/short-drama/references/creator-workflow.md +38 -2
- package/lib/drama/skills/short-drama/references/knowhow-index.md +3 -0
- package/lib/drama/skills/short-drama/references/reference-roles.md +10 -7
- package/lib/drama/skills/short-drama/references/runtime-preflight.md +3 -0
- package/lib/drama/skills/short-drama/scripts/creator_markdown_check.py +1002 -0
- package/lib/drama/skills/short-drama/scripts/project_tool.py +485 -5
- package/lib/drama/skills/short-drama-assets/SKILL.md +13 -3
- package/lib/drama/skills/short-drama-assets/references/continuity-lock.md +116 -0
- package/lib/drama/skills/short-drama-assets/references/identity-vs-variant.md +2 -1
- package/lib/drama/skills/short-drama-assets/references/prop-and-state.md +19 -0
- package/lib/drama/skills/short-drama-assets/references/stage-contract.md +2 -0
- package/lib/drama/skills/short-drama-assets/scripts/asset_check.py +1 -1
- package/lib/drama/skills/short-drama-image-prompts/SKILL.md +6 -2
- package/lib/drama/skills/short-drama-image-prompts/references/common-recipe.md +4 -3
- package/lib/drama/skills/short-drama-image-prompts/references/lookdev-frame.md +1 -1
- package/lib/drama/skills/short-drama-image-prompts/references/review-and-fixtures.md +1 -1
- package/lib/drama/skills/short-drama-image-prompts/references/stage-contract.md +3 -1
- package/lib/drama/skills/short-drama-image-prompts/scripts/image_prompt_check.py +8 -8
- package/lib/drama/skills/short-drama-image-prompts/scripts/selftest.py +4 -2
- package/lib/drama/skills/short-drama-produce/SKILL.md +46 -10
- package/lib/drama/skills/short-drama-produce/references/adapter-contract.md +65 -8
- package/lib/drama/skills/short-drama-produce/references/providers/minimax-h3-video.md +85 -0
- package/lib/drama/skills/short-drama-produce/references/providers/seedance.md +27 -10
- package/lib/drama/skills/short-drama-produce/scripts/production_tool.py +362 -3
- package/lib/drama/skills/short-drama-produce/scripts/provider_adapters.py +627 -40
- package/lib/drama/skills/short-drama-produce/scripts/selftest.py +5 -4
- package/lib/drama/skills/short-drama-review/references/rubric-visual-motion.md +12 -0
- package/lib/drama/skills/short-drama-review/scripts/review_check.py +1 -1
- package/lib/drama/skills/short-drama-storyboard/SKILL.md +76 -7
- package/lib/drama/skills/short-drama-storyboard/assets/shot-template.jsonl +1 -1
- package/lib/drama/skills/short-drama-storyboard/references/keyframe-craft.md +6 -2
- package/lib/drama/skills/short-drama-storyboard/references/production-shot-grammar.md +19 -4
- package/lib/drama/skills/short-drama-storyboard/references/review-and-fixtures.md +5 -2
- package/lib/drama/skills/short-drama-storyboard/references/screenplay-to-keyframe-example.md +16 -0
- package/lib/drama/skills/short-drama-storyboard/references/stage-contract.md +8 -3
- package/lib/drama/skills/short-drama-storyboard/scripts/storyboard_check.py +1 -1
- package/lib/drama/skills/short-drama-video-prompts/SKILL.md +81 -13
- package/lib/drama/skills/short-drama-video-prompts/assets/motion-spec.jsonl.md +6 -1
- package/lib/drama/skills/short-drama-video-prompts/assets/video-prompts.md +17 -1
- package/lib/drama/skills/short-drama-video-prompts/references/delivery-profile.md +21 -1
- package/lib/drama/skills/short-drama-video-prompts/references/minimax-h3.md +154 -0
- package/lib/drama/skills/short-drama-video-prompts/references/motion-recipe.md +24 -6
- package/lib/drama/skills/short-drama-video-prompts/references/production-prompt-grammar.md +11 -7
- package/lib/drama/skills/short-drama-video-prompts/references/seedance-2.0.md +41 -0
- package/lib/drama/skills/short-drama-video-prompts/references/seedance-2.5.md +66 -0
- package/lib/drama/skills/short-drama-video-prompts/references/stage-contract.md +5 -2
- package/lib/drama/skills/short-drama-video-prompts/references/target-model-profile.md +115 -0
- package/lib/drama/skills/short-drama-video-prompts/scripts/container_check.py +1 -1
- package/lib/drama/skills/short-drama-video-prompts/scripts/music_spec_check.py +1 -1
- package/lib/drama/skills/short-drama-write/SKILL.md +3 -2
- package/lib/drama/skills/short-drama-write/scripts/duration_estimate.py +1 -1
- package/lib/drama/skills/short-drama-write/scripts/screenplay_index.py +2 -2
- package/lib/drama/skills/short-drama-write/scripts/voice_sheet_check.py +1 -1
- package/lib/index.js +865 -33
- package/lib/index.js.map +4 -4
- package/lib/novel-to-game/LICENSE +21 -0
- package/lib/novel-to-game/README.md +180 -0
- package/lib/novel-to-game/README_ZH.md +178 -0
- package/lib/novel-to-game/VERSION +1 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/BUILD_BRIEF.md +217 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/.vercelignore +3 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/RUN.md +130 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/bg/compound_new_guofeng.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/fate_coda.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/meng.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/pan.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/pinger.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/xuee.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/finale/yue.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/inner_court_accord_five.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/inner_court_afterglow_five.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/inner_court_alliance.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/public_day10.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/public_day15.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/public_day5.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/group/title_new_guofeng.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/pan_pinger.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/pan_xuee.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/yue_meng.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/yue_pan.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/joint/yue_pinger.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/meng/explicit.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/meng/prelude.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/meng.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/pan.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/pinger.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/xuee.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/milestone/yue.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pan/explicit.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pan/prelude.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pinger/explicit.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/pinger/prelude.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/xuee/explicit.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/xuee/prelude.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/yue/explicit.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/cg/yue/prelude.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/meng/night.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/pan/night.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/pinger/night.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/xuee/night.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/heroine/yue/night.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/household/li_jiaoer.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/assets/scene/gate_collector.webp +0 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/css/new-guofeng.css +1105 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/css/style.css +2539 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/index.html +18 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/assets.js +147 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/audio.js +332 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/data.js +7472 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/engine.js +13077 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/main.js +3028 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/js/text.js +32 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/package.json +10 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/app/vercel.json +23 -0
- package/lib/novel-to-game/examples/jin-ping-mei/build/art/generated-art.json +161 -0
- package/lib/novel-to-game/examples/jin-ping-mei/example.json +12 -0
- package/lib/novel-to-game/examples/jin-ping-mei/qa/README.md +31 -0
- package/lib/novel-to-game/examples/jin-ping-mei/qa/playable-model.json +99 -0
- package/lib/novel-to-game/examples/jin-ping-mei/qa/verification.json +41 -0
- package/lib/novel-to-game/examples/jin-ping-mei/qa/verify_playable_model.mjs +129 -0
- package/lib/novel-to-game/manifest.json +508 -0
- package/lib/novel-to-game/skills/game-art-direction/SKILL.md +73 -0
- package/lib/novel-to-game/skills/game-art-direction/agents/openai.yaml +4 -0
- package/lib/novel-to-game/skills/game-art-direction/references/art-direction-method.md +119 -0
- package/lib/novel-to-game/skills/game-build/SKILL.md +84 -0
- package/lib/novel-to-game/skills/game-build/agents/openai.yaml +4 -0
- package/lib/novel-to-game/skills/game-build/references/build-brief-contract.md +109 -0
- package/lib/novel-to-game/skills/game-build/references/generative-media-pipeline.md +56 -0
- package/lib/novel-to-game/skills/game-build/references/playable-model-contract.md +81 -0
- package/lib/novel-to-game/skills/game-build/references/tts-production-contract.md +37 -0
- package/lib/novel-to-game/skills/game-concept/SKILL.md +72 -0
- package/lib/novel-to-game/skills/game-concept/agents/openai.yaml +4 -0
- package/lib/novel-to-game/skills/game-concept/references/concept-method.md +94 -0
- package/lib/novel-to-game/skills/game-qa/SKILL.md +50 -0
- package/lib/novel-to-game/skills/game-qa/agents/openai.yaml +4 -0
- package/lib/novel-to-game/skills/game-qa/references/qa-contract.md +66 -0
- package/lib/novel-to-game/skills/game-qa/references/test-design-method.md +45 -0
- package/lib/novel-to-game/skills/game-world-design/SKILL.md +63 -0
- package/lib/novel-to-game/skills/game-world-design/agents/openai.yaml +4 -0
- package/lib/novel-to-game/skills/game-world-design/references/dialogue-design-method.md +59 -0
- package/lib/novel-to-game/skills/game-world-design/references/game-writing-craft.md +53 -0
- package/lib/novel-to-game/skills/game-world-design/references/narrative-design-method.md +84 -0
- package/lib/novel-to-game/skills/game-world-design/references/numeric-design-method.md +56 -0
- package/lib/novel-to-game/skills/game-world-design/references/world-design-method.md +124 -0
- package/lib/novel-to-game/skills/novel-game-analyze/SKILL.md +77 -0
- package/lib/novel-to-game/skills/novel-game-analyze/agents/openai.yaml +4 -0
- package/lib/novel-to-game/skills/novel-game-analyze/references/gameability-protocol.md +65 -0
- package/lib/novel-to-game/skills/novel-to-game/SKILL.md +71 -0
- package/lib/novel-to-game/skills/novel-to-game/agents/openai.yaml +4 -0
- package/lib/novel-to-game/skills/novel-to-game/references/intake-benchmark-reference.md +42 -0
- package/lib/novel-to-game/skills/novel-to-game/references/intake-method.md +51 -0
- package/lib/novel-to-game/skills/novel-to-game/references/pipeline-contract.md +65 -0
- package/lib/oh-story/manifest.json +415 -305
- package/lib/oh-story/roles/consistency-checker.md +1 -1
- package/lib/oh-story/roles/narrative-writer.md +32 -33
- package/lib/oh-story/roles/story-architect.md +16 -26
- package/lib/oh-story/skills/browser-cdp/SKILL.md +1 -1
- package/lib/oh-story/skills/story/SKILL.md +16 -9
- package/lib/oh-story/skills/story/VERSION +1 -1
- package/lib/oh-story/skills/story/references/author-memory.md +163 -0
- package/lib/oh-story/skills/story/scripts/author_memory_commit.py +871 -0
- package/lib/oh-story/skills/story-cover/SKILL.md +1 -1
- package/lib/oh-story/skills/story-deslop/SKILL.md +10 -5
- package/lib/oh-story/skills/story-deslop/references/anti-ai-writing.md +2 -1
- package/lib/oh-story/skills/story-deslop/references/author-memory.md +163 -0
- package/lib/oh-story/skills/story-deslop/references/banned-words.md +6 -4
- package/lib/oh-story/skills/story-deslop/scripts/author_memory_commit.py +871 -0
- package/lib/oh-story/skills/story-deslop/scripts/check-ai-patterns.js +64 -1
- package/lib/oh-story/skills/story-import/SKILL.md +19 -10
- package/lib/oh-story/skills/story-import/references/format-and-structure.md +9 -10
- package/lib/oh-story/skills/story-import/references/structure-mapping-long.md +2 -2
- package/lib/oh-story/skills/story-import/references/structure-mapping-short.md +1 -1
- package/lib/oh-story/skills/story-import/references/tracking-transaction.md +14 -6
- package/lib/oh-story/skills/story-import/scripts/check-outline-contract.js +251 -0
- package/lib/oh-story/skills/story-import/scripts/tracking_commit.py +98 -9
- package/lib/oh-story/skills/story-import/scripts/wordcount_core.py +246 -0
- package/lib/oh-story/skills/story-long-analyze/SKILL.md +4 -4
- package/lib/oh-story/skills/story-long-scan/SKILL.md +1 -1
- package/lib/oh-story/skills/story-long-write/SKILL.md +35 -21
- package/lib/oh-story/skills/story-long-write/references/anti-ai-writing.md +2 -1
- package/lib/oh-story/skills/story-long-write/references/artifact-protocols.md +7 -3
- package/lib/oh-story/skills/story-long-write/references/author-memory.md +163 -0
- package/lib/oh-story/skills/story-long-write/references/banned-words.md +6 -4
- package/lib/oh-story/skills/story-long-write/references/cross-book-recall.md +6 -6
- package/lib/oh-story/skills/story-long-write/references/genre-prose-cards.md +1 -1
- package/lib/oh-story/skills/story-long-write/references/genre-readers.md +1 -1
- package/lib/oh-story/skills/{story-setup/references/agent-references/hooks-chapter.md → story-long-write/references/long-chapter-hooks.md} +5 -5
- package/lib/oh-story/skills/story-long-write/references/{quality-checklist.md → long-chapter-quality.md} +2 -1
- package/lib/oh-story/skills/story-long-write/references/long-format.md +42 -0
- package/lib/oh-story/skills/{story-setup/references/agent-references/genre-catalog.md → story-long-write/references/long-genre-catalog.md} +11 -97
- package/lib/oh-story/skills/{story-setup/references/agent-references/genre-core-mechanics.md → story-long-write/references/long-genre-mechanics.md} +1 -1
- package/lib/oh-story/skills/{story-short-write/references/reversal-toolkit.md → story-long-write/references/long-reversal.md} +18 -32
- package/lib/oh-story/skills/story-long-write/references/{hooks-suspense.md → long-suspense.md} +6 -6
- package/lib/oh-story/skills/story-long-write/references/opening-design.md +1 -1
- package/lib/oh-story/skills/story-long-write/references/outline-structure-theory.md +1 -1
- package/lib/oh-story/skills/story-long-write/references/style-genre-modules.md +1 -1
- package/lib/oh-story/skills/story-long-write/references/tracking-transaction.md +14 -6
- package/lib/oh-story/skills/story-long-write/references/workflow-chapter.md +32 -27
- package/lib/oh-story/skills/story-long-write/references/workflow-daily.md +4 -4
- package/lib/oh-story/skills/story-long-write/references/workflow-revision.md +2 -2
- package/lib/oh-story/skills/story-long-write/references/workflow-setup.md +14 -14
- package/lib/oh-story/skills/story-long-write/references/writing-craft.md +54 -54
- package/lib/oh-story/skills/story-long-write/scripts/author_memory_commit.py +871 -0
- package/lib/oh-story/skills/story-long-write/scripts/check-ai-patterns.js +64 -1
- package/lib/oh-story/skills/story-long-write/scripts/check-outline-contract.js +251 -0
- package/lib/oh-story/skills/story-long-write/scripts/storyctl.py +303 -0
- package/lib/oh-story/skills/story-long-write/scripts/tracking_commit.py +98 -9
- package/lib/oh-story/skills/story-long-write/scripts/wordcount_core.py +246 -0
- package/lib/oh-story/skills/story-review/SKILL.md +26 -17
- package/lib/oh-story/skills/story-review/references/anti-ai-writing.md +2 -1
- package/lib/oh-story/skills/story-review/references/author-memory.md +163 -0
- package/lib/oh-story/skills/story-review/references/banned-words.md +6 -4
- package/lib/oh-story/skills/story-review/references/{quality-checklist.md → review-quality.md} +22 -21
- package/lib/oh-story/skills/story-review/references/tracking-transaction.md +14 -6
- package/lib/oh-story/skills/story-review/scripts/author_memory_commit.py +871 -0
- package/lib/oh-story/skills/story-review/scripts/check-ai-patterns.js +64 -1
- package/lib/oh-story/skills/story-review/scripts/tracking_commit.py +98 -9
- package/lib/oh-story/skills/story-review/scripts/wordcount_core.py +246 -0
- package/lib/oh-story/skills/story-setup/SKILL.md +74 -33
- package/lib/oh-story/skills/story-setup/references/agent-references/agent-quality.md +72 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/agent-reference-profiles.md +55 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/anti-ai-writing.md +2 -1
- package/lib/oh-story/skills/story-setup/references/agent-references/banned-words.md +6 -4
- package/lib/oh-story/skills/story-setup/references/agent-references/format-and-structure.md +9 -10
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-prose-cards.md +1 -1
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-readers.md +1 -1
- package/lib/oh-story/skills/{story-short-analyze/references/hooks-chapter.md → story-setup/references/agent-references/long-chapter-hooks.md} +5 -5
- package/lib/oh-story/skills/story-setup/references/agent-references/long-emotional-methods.md +209 -0
- package/lib/oh-story/skills/{story-long-write/references/genre-catalog.md → story-setup/references/agent-references/long-genre-catalog.md} +11 -97
- package/lib/oh-story/skills/{story-long-write/references/genre-core-mechanics.md → story-setup/references/agent-references/long-genre-mechanics.md} +1 -1
- package/lib/oh-story/skills/story-setup/references/agent-references/long-quality.md +40 -0
- package/lib/oh-story/skills/story-setup/references/agent-references/{reversal-toolkit.md → long-reversal.md} +18 -32
- package/lib/oh-story/skills/{story-short-write/references/hooks-suspense.md → story-setup/references/agent-references/long-suspense.md} +6 -6
- package/lib/oh-story/skills/story-setup/references/agent-references/opening-design.md +1 -1
- package/lib/oh-story/skills/story-setup/references/agent-references/{emotional-methods.md → short-emotional-methods.md} +4 -4
- package/lib/oh-story/skills/{story-long-write/references/genre-writing-formulas.md → story-setup/references/agent-references/short-genre-formulas.md} +32 -44
- package/lib/oh-story/skills/story-setup/references/agent-references/short-quality.md +39 -0
- package/lib/oh-story/skills/{story-long-write/references/reversal-toolkit.md → story-setup/references/agent-references/short-reversal.md} +29 -23
- package/lib/oh-story/skills/story-setup/references/agent-references/{hooks-suspense.md → short-suspense.md} +31 -31
- package/lib/oh-story/skills/story-setup/references/agent-references/style-genre-modules.md +1 -1
- package/lib/oh-story/skills/story-setup/references/agent-references/writing-craft.md +55 -55
- package/lib/oh-story/skills/story-short-analyze/SKILL.md +28 -28
- package/lib/oh-story/skills/story-short-analyze/references/{character-basics.md → analysis-character-basics.md} +1 -1
- package/lib/oh-story/skills/story-short-analyze/references/{character-design-methods.md → analysis-character-design.md} +1 -1
- package/lib/oh-story/skills/story-short-analyze/references/{character-relations.md → analysis-character-relations.md} +1 -1
- package/lib/oh-story/skills/story-short-analyze/references/{hooks-paragraph.md → analysis-paragraph-hooks.md} +1 -1
- package/lib/oh-story/skills/story-short-analyze/references/{genre-readers.md → analysis-reader-profile.md} +2 -2
- package/lib/oh-story/skills/story-short-analyze/references/analysis-report-style.md +45 -0
- package/lib/oh-story/skills/story-short-analyze/references/analysis-short-genres.md +65 -0
- package/lib/oh-story/skills/story-short-analyze/references/analysis-short-hooks.md +77 -0
- package/lib/oh-story/skills/story-short-analyze/references/analysis-short-mechanics.md +82 -0
- package/lib/oh-story/skills/story-short-analyze/references/analysis-short-patterns.md +50 -0
- package/lib/oh-story/skills/story-short-analyze/references/analysis-short-suspense.md +98 -0
- package/lib/oh-story/skills/story-short-analyze/references/{genre-writing-techniques.md → analysis-writing-techniques.md} +21 -19
- package/lib/oh-story/skills/story-short-analyze/references/deconstruction-examples.md +1 -1
- package/lib/oh-story/skills/story-short-analyze/references/material-decomposition.md +21 -28
- package/lib/oh-story/skills/story-short-analyze/references/output-contract.md +1 -1
- package/lib/oh-story/skills/story-short-analyze/references/output-templates.md +17 -17
- package/lib/oh-story/skills/story-short-analyze/references/{quality-checklist.md → source-story-quality.md} +28 -49
- package/lib/oh-story/skills/story-short-analyze/references/zhihu-style.md +2 -2
- package/lib/oh-story/skills/story-short-scan/SKILL.md +1 -1
- package/lib/oh-story/skills/story-short-write/SKILL.md +78 -55
- package/lib/oh-story/skills/story-short-write/references/author-memory.md +163 -0
- package/lib/oh-story/skills/story-short-write/references/banned-words.md +6 -4
- package/lib/oh-story/skills/story-short-write/references/cross-book-recall.md +3 -3
- package/lib/oh-story/skills/story-short-write/references/emotional-methods.md +4 -4
- package/lib/oh-story/skills/story-short-write/references/genre-styles//344/270/226/346/203/205/346/211/223/350/204/270.md +3 -3
- package/lib/oh-story/skills/story-short-write/references/genre-styles//345/217/214/347/224/267/344/270/273.md +2 -2
- package/lib/oh-story/skills/story-short-write/references/genre-styles//345/244/215/344/273/207/346/211/223/350/204/270.md +3 -3
- package/lib/oh-story/skills/story-short-write/references/genre-styles//345/256/205/346/226/227/345/256/253/346/226/227.md +6 -6
- package/lib/oh-story/skills/story-short-write/references/genre-styles//346/200/273/350/243/201/350/261/252/351/227/250.md +3 -3
- package/lib/oh-story/skills/story-short-write/references/genre-styles//346/202/254/347/226/221.md +4 -4
- package/lib/oh-story/skills/story-short-write/references/genre-styles//346/260/221/344/277/227/346/200/252/350/260/210.md +7 -7
- package/lib/oh-story/skills/story-short-write/references/genre-styles//346/262/231/351/233/225/350/204/221/346/264/236.md +5 -5
- package/lib/oh-story/skills/story-short-write/references/genre-styles//347/224/234/345/256/240.md +4 -4
- package/lib/oh-story/skills/story-short-write/references/genre-styles//350/277/275/345/246/273/347/201/253/350/221/254/345/234/272.md +3 -3
- package/lib/oh-story/skills/story-short-write/references/genre-writing-formulas.md +32 -44
- package/lib/oh-story/skills/story-short-write/references/genre-writing-techniques.md +20 -18
- package/lib/oh-story/skills/story-short-write/references/output-contract.md +1 -1
- package/lib/oh-story/skills/story-short-write/references/short-craft.md +18 -18
- package/lib/oh-story/skills/story-short-write/references/short-deslop.md +1 -1
- package/lib/oh-story/skills/story-short-write/references/short-format.md +38 -8
- package/lib/oh-story/skills/story-short-write/references/{quality-checklist.md → short-prose-quality.md} +22 -21
- package/lib/oh-story/skills/story-short-write/references/short-reversal.md +355 -0
- package/lib/oh-story/skills/{story-short-analyze/references/hooks-suspense.md → story-short-write/references/short-suspense.md} +31 -31
- package/lib/oh-story/skills/story-short-write/references/submission-craft.md +2 -2
- package/lib/oh-story/skills/story-short-write/references/writing-workflow.md +31 -22
- package/lib/oh-story/skills/story-short-write/scripts/author_memory_commit.py +871 -0
- package/lib/oh-story/skills/story-short-write/scripts/check-ai-patterns.js +64 -1
- package/lib/oh-story/skills/story-short-write/scripts/check-delivery-contract.js +212 -0
- package/lib/oh-story/skills/story-short-write/scripts/check-phase2-contract.js +363 -0
- package/lib/types/client/drama-production-view.d.ts +34 -0
- package/lib/types/client/drama-production-view.d.ts.map +1 -0
- package/lib/types/client/drama-production.d.ts +92 -0
- package/lib/types/client/drama-production.d.ts.map +1 -0
- package/lib/types/client/file-activity.d.ts +4 -2
- package/lib/types/client/file-activity.d.ts.map +1 -1
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/production-intents.d.ts +9 -0
- package/lib/types/client/production-intents.d.ts.map +1 -0
- package/lib/types/client/production-prompts.d.ts +9 -0
- package/lib/types/client/production-prompts.d.ts.map +1 -0
- package/lib/types/client/production-runtime.d.ts +58 -0
- package/lib/types/client/production-runtime.d.ts.map +1 -0
- package/lib/types/client/video-studio.d.ts +41 -0
- package/lib/types/client/video-studio.d.ts.map +1 -0
- package/lib/types/client/workbench-ui.d.ts +5 -0
- package/lib/types/client/workbench-ui.d.ts.map +1 -0
- package/lib/types/game-verification.d.ts +16 -0
- package/lib/types/game-verification.d.ts.map +1 -0
- package/lib/types/index.d.ts +3 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/production-intent.d.ts +21 -0
- package/lib/types/production-intent.d.ts.map +1 -0
- package/lib/types/production-tool.d.ts +5 -0
- package/lib/types/production-tool.d.ts.map +1 -0
- package/lib/types/role-tool.d.ts.map +1 -1
- package/lib/types/skill-provider.d.ts +7 -0
- package/lib/types/skill-provider.d.ts.map +1 -1
- package/lib/types/video-project.d.ts +42 -0
- package/lib/types/video-project.d.ts.map +1 -0
- package/lib/types/workspace-request-trust.d.ts +6 -0
- package/lib/types/workspace-request-trust.d.ts.map +1 -1
- package/lib/types/workspace-route.d.ts +20 -0
- package/lib/types/workspace-route.d.ts.map +1 -1
- package/lib/video-recap/CHANGELOG.md +282 -0
- package/lib/video-recap/LICENSE +21 -0
- package/lib/video-recap/README.en.md +257 -0
- package/lib/video-recap/README.md +255 -0
- package/lib/video-recap/manifest.json +684 -0
- package/lib/video-recap/skills/video-assemble/SKILL.md +97 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/LICENSE.duo-video +21 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/SOURCE.md +15 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_draft_meta_info.json +69 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_combination_segment.json +84 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_combination_video_material.json +98 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_draft.json +204 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_material_video.json +83 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_meta_material_value.json +23 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_project_info.json +133 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_segment.json +70 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_jy_text_styles.json +30 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_yj_material_audio.json +41 -0
- package/lib/video-recap/skills/video-assemble/references/jianying/empty_yj_material_text.json +109 -0
- package/lib/video-recap/skills/video-assemble/scripts/artifacts.py +88 -0
- package/lib/video-recap/skills/video-assemble/scripts/assemble.py +345 -0
- package/lib/video-recap/skills/video-assemble/scripts/assemble_constants.py +34 -0
- package/lib/video-recap/skills/video-assemble/scripts/assembly_contract.py +305 -0
- package/lib/video-recap/skills/video-assemble/scripts/assembly_settings.py +94 -0
- package/lib/video-recap/skills/video-assemble/scripts/audio_automation.py +205 -0
- package/lib/video-recap/skills/video-assemble/scripts/audio_mix.py +555 -0
- package/lib/video-recap/skills/video-assemble/scripts/export_jianying.py +261 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_builders.py +767 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_model.py +111 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_optional.py +24 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_schema.py +109 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_templates.py +37 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_timeline_contract.py +191 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_tracks.py +75 -0
- package/lib/video-recap/skills/video-assemble/scripts/jianying_writer.py +394 -0
- package/lib/video-recap/skills/video-assemble/scripts/lib.py +239 -0
- package/lib/video-recap/skills/video-assemble/scripts/media.py +243 -0
- package/lib/video-recap/skills/video-assemble/scripts/narration_audio.py +477 -0
- package/lib/video-recap/skills/video-assemble/scripts/render_preflight.py +46 -0
- package/lib/video-recap/skills/video-assemble/scripts/source_subtitles.py +486 -0
- package/lib/video-recap/skills/video-assemble/scripts/subtitle_core.py +376 -0
- package/lib/video-recap/skills/video-assemble/scripts/subtitle_render.py +88 -0
- package/lib/video-recap/skills/video-assemble/scripts/timeline.py +248 -0
- package/lib/video-recap/skills/video-assemble/scripts/timeline_emit.py +89 -0
- package/lib/video-recap/skills/video-assemble/scripts/visual_render.py +512 -0
- package/lib/video-recap/skills/video-cut/SKILL.md +90 -0
- package/lib/video-recap/skills/video-cut/scripts/cut.py +67 -0
- package/lib/video-recap/skills/video-cut/scripts/cut_cli.py +320 -0
- package/lib/video-recap/skills/video-cut/scripts/cut_contract.py +545 -0
- package/lib/video-recap/skills/video-cut/scripts/cut_render.py +348 -0
- package/lib/video-recap/skills/video-cut/scripts/lib.py +77 -0
- package/lib/video-recap/skills/video-cut/scripts/media_geometry.py +341 -0
- package/lib/video-recap/skills/video-cut/scripts/narration_mapping.py +249 -0
- package/lib/video-recap/skills/video-cut/scripts/sentence_boundaries.py +745 -0
- package/lib/video-recap/skills/video-recap/SKILL.md +216 -0
- package/lib/video-recap/skills/video-recap/references/config-playbook.md +61 -0
- package/lib/video-recap/skills/video-recap/references/creative-editing-playbook.md +225 -0
- package/lib/video-recap/skills/video-recap/references/data-schema.md +534 -0
- package/lib/video-recap/skills/video-recap/references/research-guide.md +74 -0
- package/lib/video-recap/skills/video-recap/references/shift-left-qc-schema.md +23 -0
- package/lib/video-recap/skills/video-recap/references/timeline-and-jianying.md +251 -0
- package/lib/video-recap/skills/video-recap/scripts/doctor.py +483 -0
- package/lib/video-recap/skills/video-recap/scripts/final_qc.py +737 -0
- package/lib/video-recap/skills/video-recap/scripts/lib.py +242 -0
- package/lib/video-recap/skills/video-recap/scripts/materials.py +457 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc.py +95 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc_client.py +18 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc_contract.py +9 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc_evidence.py +371 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc_observations.py +201 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc_payload.py +227 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc_report.py +362 -0
- package/lib/video-recap/skills/video-recap/scripts/mimo_qc_runner.py +129 -0
- package/lib/video-recap/skills/video-recap/scripts/qc_contract.py +338 -0
- package/lib/video-recap/skills/video-recap/scripts/recap.py +9 -0
- package/lib/video-recap/skills/video-recap/scripts/recap_cli.py +140 -0
- package/lib/video-recap/skills/video-recap/scripts/recap_inspect.py +550 -0
- package/lib/video-recap/skills/video-recap/scripts/recap_review.py +77 -0
- package/lib/video-recap/skills/video-recap/scripts/recap_runner.py +654 -0
- package/lib/video-recap/skills/video-recap/scripts/recap_runtime.py +335 -0
- package/lib/video-recap/skills/video-recap/scripts/recap_stage_qc.py +217 -0
- package/lib/video-recap/skills/video-recap/scripts/recap_timeline.py +795 -0
- package/lib/video-recap/skills/video-script/SKILL.md +248 -0
- package/lib/video-recap/skills/video-script/references/creative-editing-playbook.md +225 -0
- package/lib/video-recap/skills/video-script/references/research-guide.md +75 -0
- package/lib/video-recap/skills/video-script/scripts/agent_brief.py +399 -0
- package/lib/video-recap/skills/video-script/scripts/agent_text.py +410 -0
- package/lib/video-recap/skills/video-script/scripts/brief_context.py +403 -0
- package/lib/video-recap/skills/video-script/scripts/brief_inputs.py +332 -0
- package/lib/video-recap/skills/video-script/scripts/brief_timeline.py +442 -0
- package/lib/video-recap/skills/video-script/scripts/deslop_qc.py +237 -0
- package/lib/video-recap/skills/video-script/scripts/evidence_bundle.py +492 -0
- package/lib/video-recap/skills/video-script/scripts/lib.py +327 -0
- package/lib/video-recap/skills/video-script/scripts/narration.py +12 -0
- package/lib/video-recap/skills/video-script/scripts/narration_lint.py +678 -0
- package/lib/video-recap/skills/video-script/scripts/review.py +42 -0
- package/lib/video-recap/skills/video-script/scripts/review_grounding.py +262 -0
- package/lib/video-recap/skills/video-script/scripts/review_response.py +761 -0
- package/lib/video-recap/skills/video-script/scripts/review_runner.py +200 -0
- package/lib/video-recap/skills/video-script/scripts/speech_ownership.py +204 -0
- package/lib/video-recap/skills/video-script/scripts/timeline_fusion.py +199 -0
- package/lib/video-recap/skills/video-script/scripts/validate.py +164 -0
- package/lib/video-recap/skills/video-understanding/SKILL.md +75 -0
- package/lib/video-recap/skills/video-understanding/references/data-schema.md +299 -0
- package/lib/video-recap/skills/video-understanding/references/prompt-templates.md +37 -0
- package/lib/video-recap/skills/video-understanding/references/research-guide.md +74 -0
- package/lib/video-recap/skills/video-understanding/scripts/agent_brief.py +399 -0
- package/lib/video-recap/skills/video-understanding/scripts/agent_text.py +410 -0
- package/lib/video-recap/skills/video-understanding/scripts/asr.py +260 -0
- package/lib/video-recap/skills/video-understanding/scripts/brief.py +12 -0
- package/lib/video-recap/skills/video-understanding/scripts/brief_context.py +403 -0
- package/lib/video-recap/skills/video-understanding/scripts/brief_inputs.py +332 -0
- package/lib/video-recap/skills/video-understanding/scripts/brief_timeline.py +442 -0
- package/lib/video-recap/skills/video-understanding/scripts/consolidate.py +647 -0
- package/lib/video-recap/skills/video-understanding/scripts/deslop_qc.py +237 -0
- package/lib/video-recap/skills/video-understanding/scripts/detect.py +513 -0
- package/lib/video-recap/skills/video-understanding/scripts/extract.py +62 -0
- package/lib/video-recap/skills/video-understanding/scripts/lib.py +470 -0
- package/lib/video-recap/skills/video-understanding/scripts/narration_lint.py +678 -0
- package/lib/video-recap/skills/video-understanding/scripts/speech_ownership.py +204 -0
- package/lib/video-recap/skills/video-understanding/scripts/storyboard.py +507 -0
- package/lib/video-recap/skills/video-understanding/scripts/timeline_fusion.py +199 -0
- package/lib/video-recap/skills/video-understanding/scripts/understand.py +9 -0
- package/lib/video-recap/skills/video-understanding/scripts/understanding_brief.py +216 -0
- package/lib/video-recap/skills/video-understanding/scripts/understanding_cache.py +327 -0
- package/lib/video-recap/skills/video-understanding/scripts/understanding_runner.py +367 -0
- package/lib/video-recap/skills/video-understanding/scripts/understanding_storyboard.py +162 -0
- package/lib/video-recap/skills/video-understanding/scripts/vlm.py +705 -0
- package/lib/video-recap/skills/video-voiceover/SKILL.md +81 -0
- package/lib/video-recap/skills/video-voiceover/scripts/dub.py +637 -0
- package/lib/video-recap/skills/video-voiceover/scripts/fish_audio.py +109 -0
- package/lib/video-recap/skills/video-voiceover/scripts/lib.py +421 -0
- package/lib/video-recap/skills/video-voiceover/scripts/tts_audio.py +113 -0
- package/lib/video-recap/skills/video-voiceover/scripts/voiceover.py +782 -0
- package/package.json +55 -40
- package/lib/oh-story/skills/story-deslop/scripts/check-outline-copy.js +0 -241
- package/lib/oh-story/skills/story-long-write/references/format-and-structure.md +0 -169
- package/lib/oh-story/skills/story-setup/references/agent-references/genre-writing-formulas.md +0 -444
- package/lib/oh-story/skills/story-setup/references/agent-references/quality-checklist.md +0 -247
- package/lib/oh-story/skills/story-short-analyze/references/anti-ai-writing.md +0 -582
- package/lib/oh-story/skills/story-short-analyze/references/banned-words.md +0 -147
- package/lib/oh-story/skills/story-short-analyze/references/genre-catalog.md +0 -490
- package/lib/oh-story/skills/story-short-analyze/references/genre-core-mechanics.md +0 -425
- package/lib/oh-story/skills/story-short-analyze/references/genre-writing-formulas.md +0 -453
- /package/lib/oh-story/skills/{story-long-write/references/hooks-chapter.md → story-setup/references/agent-references/short-chapter-hooks.md} +0 -0
- /package/lib/oh-story/skills/{story-long-write/references/hooks-paragraph.md → story-setup/references/agent-references/short-paragraph-hooks.md} +0 -0
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
"""Probe display geometry and select a stable output canvas."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from lib import run_cmd
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _has_audio_stream(video_path):
|
|
10
|
+
cmd = [
|
|
11
|
+
"ffprobe",
|
|
12
|
+
"-v",
|
|
13
|
+
"error",
|
|
14
|
+
"-select_streams",
|
|
15
|
+
"a:0",
|
|
16
|
+
"-show_entries",
|
|
17
|
+
"stream=index",
|
|
18
|
+
"-of",
|
|
19
|
+
"csv=p=0",
|
|
20
|
+
str(video_path),
|
|
21
|
+
]
|
|
22
|
+
result = run_cmd(cmd)
|
|
23
|
+
return result.returncode == 0 and bool(result.stdout.strip())
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class VideoGeometry(tuple):
|
|
27
|
+
"""Tuple-compatible geometry with probe facts attached for QC callers."""
|
|
28
|
+
|
|
29
|
+
def __new__(cls, width, height, fps, facts=None):
|
|
30
|
+
obj = super().__new__(cls, (width, height, fps))
|
|
31
|
+
obj.facts = facts or {}
|
|
32
|
+
return obj
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _parse_ratio(value):
|
|
36
|
+
if value in (None, "", "0:1", "0/1", "N/A"):
|
|
37
|
+
return None
|
|
38
|
+
text = str(value)
|
|
39
|
+
sep = ":" if ":" in text else "/" if "/" in text else None
|
|
40
|
+
if not sep:
|
|
41
|
+
try:
|
|
42
|
+
ratio = float(text)
|
|
43
|
+
return ratio if ratio > 0 else None
|
|
44
|
+
except ValueError:
|
|
45
|
+
return None
|
|
46
|
+
left, _, right = text.partition(sep)
|
|
47
|
+
try:
|
|
48
|
+
num, den = float(left), float(right)
|
|
49
|
+
except ValueError:
|
|
50
|
+
return None
|
|
51
|
+
return num / den if den > 0 and num > 0 else None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _stream_rotation(stream):
|
|
55
|
+
candidates = []
|
|
56
|
+
tags = stream.get("tags") if isinstance(stream.get("tags"), dict) else {}
|
|
57
|
+
if "rotate" in tags:
|
|
58
|
+
candidates.append(tags.get("rotate"))
|
|
59
|
+
for side_data in stream.get("side_data_list") or []:
|
|
60
|
+
if isinstance(side_data, dict):
|
|
61
|
+
candidates.append(side_data.get("rotation"))
|
|
62
|
+
for value in candidates:
|
|
63
|
+
try:
|
|
64
|
+
return int(round(float(value))) % 360
|
|
65
|
+
except (TypeError, ValueError):
|
|
66
|
+
continue
|
|
67
|
+
return 0
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _fps_from_rate(rate):
|
|
71
|
+
if not rate or "/" not in str(rate):
|
|
72
|
+
return 0.0
|
|
73
|
+
num, _, den = str(rate).partition("/")
|
|
74
|
+
try:
|
|
75
|
+
num_f, den_f = float(num), float(den)
|
|
76
|
+
return num_f / den_f if den_f > 0 else 0.0
|
|
77
|
+
except ValueError:
|
|
78
|
+
return 0.0
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _geometry_from_stream(stream, *, fallback=False):
|
|
82
|
+
coded_width = coded_height = 0
|
|
83
|
+
try:
|
|
84
|
+
coded_width = int(float(stream.get("width") or 0))
|
|
85
|
+
coded_height = int(float(stream.get("height") or 0))
|
|
86
|
+
except (TypeError, ValueError):
|
|
87
|
+
coded_width = coded_height = 0
|
|
88
|
+
if coded_width <= 0 or coded_height <= 0:
|
|
89
|
+
coded_width, coded_height = 1280, 720
|
|
90
|
+
fallback = True
|
|
91
|
+
|
|
92
|
+
parsed_sar = _parse_ratio(stream.get("sample_aspect_ratio"))
|
|
93
|
+
dar = _parse_ratio(stream.get("display_aspect_ratio"))
|
|
94
|
+
rotation = _stream_rotation(stream)
|
|
95
|
+
display_height = float(coded_height)
|
|
96
|
+
if parsed_sar:
|
|
97
|
+
sar = parsed_sar
|
|
98
|
+
display_width = float(coded_width) * sar
|
|
99
|
+
aspect_source = "sample_aspect_ratio"
|
|
100
|
+
elif dar:
|
|
101
|
+
sar = 1.0
|
|
102
|
+
display_width = display_height * dar
|
|
103
|
+
aspect_source = "display_aspect_ratio_fallback"
|
|
104
|
+
else:
|
|
105
|
+
sar = 1.0
|
|
106
|
+
display_width = float(coded_width)
|
|
107
|
+
aspect_source = "square_pixel_fallback"
|
|
108
|
+
rotation_swaps_axes = rotation in {90, 270}
|
|
109
|
+
if rotation_swaps_axes:
|
|
110
|
+
display_width, display_height = display_height, display_width
|
|
111
|
+
|
|
112
|
+
width, height = _clamp_even_geometry(round(display_width), round(display_height))
|
|
113
|
+
fps = _fps_from_rate(stream.get("r_frame_rate")) or _fps_from_rate(
|
|
114
|
+
stream.get("avg_frame_rate")
|
|
115
|
+
)
|
|
116
|
+
if not 0 < fps <= 120:
|
|
117
|
+
fps = 30.0
|
|
118
|
+
facts = {
|
|
119
|
+
"coded_width": coded_width,
|
|
120
|
+
"coded_height": coded_height,
|
|
121
|
+
"width": width,
|
|
122
|
+
"height": height,
|
|
123
|
+
"fps": round(fps, 3),
|
|
124
|
+
"sample_aspect_ratio": stream.get("sample_aspect_ratio") or "1:1",
|
|
125
|
+
"sample_aspect_ratio_float": round(float(sar), 6),
|
|
126
|
+
"display_aspect_ratio": stream.get("display_aspect_ratio"),
|
|
127
|
+
"display_aspect_ratio_float": round(float(dar or 0.0), 6),
|
|
128
|
+
"display_aspect_source": aspect_source,
|
|
129
|
+
"display_width": width,
|
|
130
|
+
"display_height": height,
|
|
131
|
+
"rotation": rotation,
|
|
132
|
+
"rotation_swaps_axes": rotation_swaps_axes,
|
|
133
|
+
"fallback": bool(fallback),
|
|
134
|
+
}
|
|
135
|
+
return VideoGeometry(width, height, round(fps, 3), facts)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def _probe_video_geometry(video_path):
|
|
139
|
+
"""Best-effort iterable (width, height, fps), rotation/SAR/DAR-aware.
|
|
140
|
+
|
|
141
|
+
Returned value unpacks like the historical 3-tuple while exposing `.facts`
|
|
142
|
+
for QC. Used to normalize heterogeneous multi-source segments to one
|
|
143
|
+
square-pixel geometry before concat (ffmpeg's concat filter rejects
|
|
144
|
+
mismatched width/height/SAR/pixel-format/fps).
|
|
145
|
+
"""
|
|
146
|
+
cmd = [
|
|
147
|
+
"ffprobe",
|
|
148
|
+
"-v",
|
|
149
|
+
"error",
|
|
150
|
+
"-select_streams",
|
|
151
|
+
"v:0",
|
|
152
|
+
"-show_entries",
|
|
153
|
+
"stream=width,height,r_frame_rate,avg_frame_rate,sample_aspect_ratio,display_aspect_ratio:stream_tags=rotate:stream_side_data=rotation",
|
|
154
|
+
"-of",
|
|
155
|
+
"json",
|
|
156
|
+
str(video_path),
|
|
157
|
+
]
|
|
158
|
+
try:
|
|
159
|
+
result = run_cmd(cmd)
|
|
160
|
+
except Exception: # noqa: BLE001 - probing is best-effort; fall back to defaults
|
|
161
|
+
result = None
|
|
162
|
+
if (
|
|
163
|
+
result is not None
|
|
164
|
+
and getattr(result, "returncode", 1) == 0
|
|
165
|
+
and (result.stdout or "").strip()
|
|
166
|
+
):
|
|
167
|
+
try:
|
|
168
|
+
payload = json.loads(result.stdout)
|
|
169
|
+
streams = payload.get("streams") or []
|
|
170
|
+
if streams:
|
|
171
|
+
return _geometry_from_stream(streams[0])
|
|
172
|
+
except (AttributeError, TypeError, ValueError):
|
|
173
|
+
pass
|
|
174
|
+
|
|
175
|
+
# Backward-compatible fallback for tests/mocks that still return CSV output.
|
|
176
|
+
stream = {}
|
|
177
|
+
if result is not None and (result.stdout or "").strip():
|
|
178
|
+
parts = result.stdout.strip().splitlines()[0].split(",")
|
|
179
|
+
if len(parts) >= 2:
|
|
180
|
+
stream["width"], stream["height"] = parts[0], parts[1]
|
|
181
|
+
if len(parts) >= 3:
|
|
182
|
+
stream["r_frame_rate"] = parts[2]
|
|
183
|
+
if len(parts) >= 4 and parts[3] not in ("", "N/A"):
|
|
184
|
+
stream["tags"] = {"rotate": parts[3]}
|
|
185
|
+
if len(parts) >= 5 and parts[4] not in ("", "N/A"):
|
|
186
|
+
stream["sample_aspect_ratio"] = parts[4]
|
|
187
|
+
if len(parts) >= 6 and parts[5] not in ("", "N/A"):
|
|
188
|
+
stream["display_aspect_ratio"] = parts[5]
|
|
189
|
+
return _geometry_from_stream(stream, fallback=True)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def _orientation(width, height):
|
|
193
|
+
if width > height:
|
|
194
|
+
return "landscape"
|
|
195
|
+
if height > width:
|
|
196
|
+
return "portrait"
|
|
197
|
+
return "square"
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def _fps_bucket(fps):
|
|
201
|
+
if not fps or fps <= 0:
|
|
202
|
+
return 30.0
|
|
203
|
+
common = [23.976, 24.0, 25.0, 29.97, 30.0, 50.0, 59.94, 60.0]
|
|
204
|
+
nearest = min(common, key=lambda x: abs(float(fps) - x))
|
|
205
|
+
return nearest if abs(float(fps) - nearest) <= 0.15 else round(float(fps))
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def _clamp_even_geometry(width, height, max_height=None):
|
|
209
|
+
width = max(2, int(width) - int(width) % 2)
|
|
210
|
+
height = max(2, int(height) - int(height) % 2)
|
|
211
|
+
max_height = int(max_height or 0)
|
|
212
|
+
if max_height > 0 and height > max_height:
|
|
213
|
+
scale = max_height / height
|
|
214
|
+
height = max_height - max_height % 2
|
|
215
|
+
width = max(2, int(width * scale))
|
|
216
|
+
width -= width % 2
|
|
217
|
+
return width, height
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def _select_output_geometry(source_paths, clips, max_height=None):
|
|
221
|
+
"""Deterministically select canvas/fps from all used sources, not just the first."""
|
|
222
|
+
used = {}
|
|
223
|
+
for clip in clips or []:
|
|
224
|
+
path = str(clip.get("source_path") or "")
|
|
225
|
+
if not path:
|
|
226
|
+
continue
|
|
227
|
+
used[path] = used.get(path, 0.0) + max(0.0, float(clip.get("duration") or 0.0))
|
|
228
|
+
if not used:
|
|
229
|
+
for path in source_paths or []:
|
|
230
|
+
used[str(path)] = 0.0
|
|
231
|
+
rows = []
|
|
232
|
+
for path in sorted(used):
|
|
233
|
+
probed = _probe_video_geometry(path)
|
|
234
|
+
width, height, fps = probed
|
|
235
|
+
facts = dict(getattr(probed, "facts", {}) or {})
|
|
236
|
+
facts.setdefault("width", width)
|
|
237
|
+
facts.setdefault("height", height)
|
|
238
|
+
facts.setdefault("fps", fps)
|
|
239
|
+
facts.setdefault("rotation", 0)
|
|
240
|
+
facts.setdefault("sample_aspect_ratio", "1:1")
|
|
241
|
+
rows.append(
|
|
242
|
+
{
|
|
243
|
+
"path": path,
|
|
244
|
+
"source_id": next(
|
|
245
|
+
(
|
|
246
|
+
str(c.get("source_id"))
|
|
247
|
+
for c in clips or []
|
|
248
|
+
if str(c.get("source_path") or "") == path
|
|
249
|
+
and c.get("source_id") is not None
|
|
250
|
+
),
|
|
251
|
+
None,
|
|
252
|
+
),
|
|
253
|
+
"used_duration": round(used[path], 3),
|
|
254
|
+
"width": width,
|
|
255
|
+
"height": height,
|
|
256
|
+
"coded_width": facts.get("coded_width", width),
|
|
257
|
+
"coded_height": facts.get("coded_height", height),
|
|
258
|
+
"display_width": facts.get("display_width", width),
|
|
259
|
+
"display_height": facts.get("display_height", height),
|
|
260
|
+
"area": width * height,
|
|
261
|
+
"fps": fps,
|
|
262
|
+
"fps_bucket": min(60.0, _fps_bucket(fps)),
|
|
263
|
+
"orientation": _orientation(width, height),
|
|
264
|
+
"rotation": facts.get("rotation", 0),
|
|
265
|
+
"sample_aspect_ratio": facts.get("sample_aspect_ratio", "1:1"),
|
|
266
|
+
"sample_aspect_ratio_float": facts.get(
|
|
267
|
+
"sample_aspect_ratio_float", 1.0
|
|
268
|
+
),
|
|
269
|
+
"display_aspect_ratio": facts.get("display_aspect_ratio"),
|
|
270
|
+
"rotation_swaps_axes": bool(facts.get("rotation_swaps_axes", False)),
|
|
271
|
+
}
|
|
272
|
+
)
|
|
273
|
+
if not rows:
|
|
274
|
+
return (
|
|
275
|
+
1280,
|
|
276
|
+
720,
|
|
277
|
+
30.0,
|
|
278
|
+
{
|
|
279
|
+
"width": 1280,
|
|
280
|
+
"height": 720,
|
|
281
|
+
"fps": 30.0,
|
|
282
|
+
"reason": "fallback_no_sources",
|
|
283
|
+
"source_id": None,
|
|
284
|
+
},
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
orientation_duration = {}
|
|
288
|
+
for row in rows:
|
|
289
|
+
orientation_duration[row["orientation"]] = (
|
|
290
|
+
orientation_duration.get(row["orientation"], 0.0) + row["used_duration"]
|
|
291
|
+
)
|
|
292
|
+
chosen_orientation = sorted(
|
|
293
|
+
orientation_duration.items(),
|
|
294
|
+
key=lambda kv: (
|
|
295
|
+
kv[1],
|
|
296
|
+
max(r["area"] for r in rows if r["orientation"] == kv[0]),
|
|
297
|
+
kv[0],
|
|
298
|
+
),
|
|
299
|
+
reverse=True,
|
|
300
|
+
)[0][0]
|
|
301
|
+
eligible = [r for r in rows if r["orientation"] == chosen_orientation] or rows
|
|
302
|
+
selected = sorted(
|
|
303
|
+
eligible,
|
|
304
|
+
key=lambda r: (-r["area"], str(r.get("source_id") or ""), r["path"]),
|
|
305
|
+
)[0]
|
|
306
|
+
|
|
307
|
+
fps_duration = {}
|
|
308
|
+
for row in rows:
|
|
309
|
+
fps_duration[row["fps_bucket"]] = (
|
|
310
|
+
fps_duration.get(row["fps_bucket"], 0.0) + row["used_duration"]
|
|
311
|
+
)
|
|
312
|
+
fps = sorted(fps_duration.items(), key=lambda kv: (kv[1], kv[0]), reverse=True)[0][
|
|
313
|
+
0
|
|
314
|
+
]
|
|
315
|
+
fps = max(1.0, min(60.0, float(fps or 30.0)))
|
|
316
|
+
|
|
317
|
+
width, height = _clamp_even_geometry(
|
|
318
|
+
selected["width"], selected["height"], max_height=max_height
|
|
319
|
+
)
|
|
320
|
+
reason = {
|
|
321
|
+
"width": width,
|
|
322
|
+
"height": height,
|
|
323
|
+
"fps": round(fps, 3),
|
|
324
|
+
"reason": "weighted_orientation_area_fps",
|
|
325
|
+
"source_id": selected.get("source_id"),
|
|
326
|
+
"source_path": selected["path"],
|
|
327
|
+
"orientation": chosen_orientation,
|
|
328
|
+
"orientation_used_duration": round(
|
|
329
|
+
orientation_duration.get(chosen_orientation, 0.0), 3
|
|
330
|
+
),
|
|
331
|
+
"fps_bucket_used_duration": round(fps_duration.get(fps, 0.0), 3),
|
|
332
|
+
"rotation": selected.get("rotation", 0),
|
|
333
|
+
"sample_aspect_ratio": selected.get("sample_aspect_ratio", "1:1"),
|
|
334
|
+
"display_aspect_ratio": selected.get("display_aspect_ratio"),
|
|
335
|
+
"coded_width": selected.get("coded_width"),
|
|
336
|
+
"coded_height": selected.get("coded_height"),
|
|
337
|
+
"display_width": selected.get("display_width"),
|
|
338
|
+
"display_height": selected.get("display_height"),
|
|
339
|
+
"sources": rows,
|
|
340
|
+
}
|
|
341
|
+
return width, height, round(fps, 3), reason
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"""Map source-time narration onto the edited output timeline."""
|
|
2
|
+
|
|
3
|
+
from lib import log
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def source_time_to_output_time(source_time, clips):
|
|
7
|
+
"""Map a source timestamp into the post-concat output timeline."""
|
|
8
|
+
ts = float(source_time)
|
|
9
|
+
for clip in clips:
|
|
10
|
+
start = clip["source_start"]
|
|
11
|
+
end = clip["source_end"]
|
|
12
|
+
if start <= ts <= end:
|
|
13
|
+
mapped = clip["output_start"] + (ts - start)
|
|
14
|
+
return round(max(clip["output_start"], min(mapped, clip["output_end"])), 3)
|
|
15
|
+
return None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _clips_for_midpoint(start, end, clips):
|
|
19
|
+
mid = (float(start) + float(end)) / 2
|
|
20
|
+
return [clip for clip in clips if clip["source_start"] <= mid <= clip["source_end"]]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def map_narration_to_clips(narration, validated_plan, min_duration=0.3):
|
|
24
|
+
"""Convert source-time narration segments to edited-output timeline segments."""
|
|
25
|
+
clips = (
|
|
26
|
+
validated_plan["clips"] if isinstance(validated_plan, dict) else validated_plan
|
|
27
|
+
)
|
|
28
|
+
mapped = []
|
|
29
|
+
for raw in narration or []:
|
|
30
|
+
if not isinstance(raw, dict):
|
|
31
|
+
continue
|
|
32
|
+
try:
|
|
33
|
+
source_start = float(raw.get("start"))
|
|
34
|
+
source_end = float(raw.get("end"))
|
|
35
|
+
except (TypeError, ValueError):
|
|
36
|
+
continue
|
|
37
|
+
text = str(raw.get("narration", "")).strip()
|
|
38
|
+
if source_end <= source_start or not text:
|
|
39
|
+
continue
|
|
40
|
+
if raw.get("source_clip_id") is not None:
|
|
41
|
+
try:
|
|
42
|
+
requested_clip_id = int(raw.get("source_clip_id"))
|
|
43
|
+
except (TypeError, ValueError):
|
|
44
|
+
requested_clip_id = None
|
|
45
|
+
clip = next(
|
|
46
|
+
(c for c in clips if c.get("clip_id") == requested_clip_id), None
|
|
47
|
+
)
|
|
48
|
+
if clip and not (
|
|
49
|
+
clip["source_start"]
|
|
50
|
+
<= ((source_start + source_end) / 2)
|
|
51
|
+
<= clip["source_end"]
|
|
52
|
+
):
|
|
53
|
+
clip = None
|
|
54
|
+
else:
|
|
55
|
+
matches = _clips_for_midpoint(source_start, source_end, clips)
|
|
56
|
+
if len(matches) > 1:
|
|
57
|
+
log(
|
|
58
|
+
f" 丢弃重复片段中未标 source_clip_id 的解说: {source_start:.1f}-{source_end:.1f}s"
|
|
59
|
+
)
|
|
60
|
+
continue
|
|
61
|
+
clip = matches[0] if matches else None
|
|
62
|
+
if not clip:
|
|
63
|
+
log(f" 丢弃未落入剪辑片段的解说: {source_start:.1f}-{source_end:.1f}s")
|
|
64
|
+
continue
|
|
65
|
+
clipped_source_start = max(source_start, clip["source_start"])
|
|
66
|
+
clipped_source_end = min(source_end, clip["source_end"])
|
|
67
|
+
if clipped_source_end - clipped_source_start < min_duration:
|
|
68
|
+
log(f" 丢弃过短映射解说: {source_start:.1f}-{source_end:.1f}s")
|
|
69
|
+
continue
|
|
70
|
+
output_start = source_time_to_output_time(clipped_source_start, [clip])
|
|
71
|
+
output_end = source_time_to_output_time(clipped_source_end, [clip])
|
|
72
|
+
if output_start is None or output_end is None or output_end <= output_start:
|
|
73
|
+
continue
|
|
74
|
+
item = dict(raw)
|
|
75
|
+
item["source_start"] = round(clipped_source_start, 3)
|
|
76
|
+
item["source_end"] = round(clipped_source_end, 3)
|
|
77
|
+
item["source_clip_id"] = clip["clip_id"]
|
|
78
|
+
item["start"] = output_start
|
|
79
|
+
item["end"] = output_end
|
|
80
|
+
# Tag beats trimmed to a clip edge: their TEXT was written for a longer span and may
|
|
81
|
+
# now describe footage that was cut away (a stale-text desync the lint surfaces).
|
|
82
|
+
item["clamped"] = bool(
|
|
83
|
+
clipped_source_start > source_start + 1e-3
|
|
84
|
+
or clipped_source_end < source_end - 1e-3
|
|
85
|
+
)
|
|
86
|
+
mapped.append(item)
|
|
87
|
+
|
|
88
|
+
mapped.sort(key=lambda seg: seg["start"])
|
|
89
|
+
return mapped
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def lint_mapped_narration(
|
|
93
|
+
mapped,
|
|
94
|
+
original_count,
|
|
95
|
+
output_duration,
|
|
96
|
+
*,
|
|
97
|
+
min_spm=6.0,
|
|
98
|
+
max_gap_seconds=12.0,
|
|
99
|
+
drop_ratio_limit=0.3,
|
|
100
|
+
):
|
|
101
|
+
"""Advisory re-lint of narration AFTER it is mapped onto the cut OUTPUT timeline.
|
|
102
|
+
|
|
103
|
+
The mapper silently drops beats whose midpoint is outside every kept clip and clamps
|
|
104
|
+
boundary-crossers, so a narration authored against the full source can pass the
|
|
105
|
+
source-time validate yet leave the cut sparse or describing footage the viewer never
|
|
106
|
+
sees. This surfaces that on the real output timeline (narration_mapped_lint.json) and
|
|
107
|
+
returns a `blocking` verdict (heavy drop / too sparse / long gap) that the cut stage
|
|
108
|
+
enforces unless --allow-sparse-cut. Clamped beats are always blocking because their TTS
|
|
109
|
+
sentence would be cut at a clip edge; sparse-cut intent never authorizes speech truncation.
|
|
110
|
+
"""
|
|
111
|
+
mapped = sorted(mapped or [], key=lambda s: float(s.get("start", 0.0)))
|
|
112
|
+
mapped_count = len(mapped)
|
|
113
|
+
original_count = int(original_count or 0)
|
|
114
|
+
dropped = max(0, original_count - mapped_count)
|
|
115
|
+
drop_ratio = dropped / original_count if original_count else 0.0
|
|
116
|
+
out_dur = float(output_duration or 0.0)
|
|
117
|
+
spm = mapped_count / (out_dur / 60) if out_dur > 0 else 0.0
|
|
118
|
+
gaps = [float(b["start"]) - float(a["end"]) for a, b in zip(mapped, mapped[1:])]
|
|
119
|
+
max_gap = max(gaps) if gaps else 0.0
|
|
120
|
+
covered = sum(max(0.0, float(b["end"]) - float(b["start"])) for b in mapped)
|
|
121
|
+
coverage = covered / out_dur if out_dur > 0 else 0.0
|
|
122
|
+
|
|
123
|
+
warnings = []
|
|
124
|
+
if drop_ratio >= drop_ratio_limit:
|
|
125
|
+
warnings.append(
|
|
126
|
+
{
|
|
127
|
+
"code": "many_beats_dropped",
|
|
128
|
+
"message": "大量解说段落落在保留片段之外被丢弃——请按保留的片段写解说,而不是整段原片。",
|
|
129
|
+
"dropped": dropped,
|
|
130
|
+
"original": original_count,
|
|
131
|
+
"drop_ratio": round(drop_ratio, 2),
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
if mapped_count >= 2 and spm and spm < min_spm:
|
|
135
|
+
warnings.append(
|
|
136
|
+
{
|
|
137
|
+
"code": "low_density_output",
|
|
138
|
+
"message": "映射后的解说在成片里偏稀疏——在保留片段内补充解说 beat。",
|
|
139
|
+
"segments_per_minute": round(spm, 2),
|
|
140
|
+
"min_segments_per_minute": min_spm,
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
if max_gap > max_gap_seconds:
|
|
144
|
+
warnings.append(
|
|
145
|
+
{
|
|
146
|
+
"code": "long_gap_output",
|
|
147
|
+
"message": "成片里有一长段没有解说。",
|
|
148
|
+
"max_gap_seconds": round(max_gap, 2),
|
|
149
|
+
"max_gap_limit_seconds": max_gap_seconds,
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
clamped = [b for b in mapped if isinstance(b, dict) and b.get("clamped")]
|
|
153
|
+
if clamped:
|
|
154
|
+
warnings.append(
|
|
155
|
+
{
|
|
156
|
+
"code": "clamped_beats",
|
|
157
|
+
"message": "有解说段被裁到片段边界,旁白句子会被截断——必须移动片段边界或重写整句。",
|
|
158
|
+
"count": len(clamped),
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
blocking_codes = {
|
|
162
|
+
"many_beats_dropped",
|
|
163
|
+
"low_density_output",
|
|
164
|
+
"long_gap_output",
|
|
165
|
+
"clamped_beats",
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
"mapped_count": mapped_count,
|
|
169
|
+
"dropped": dropped,
|
|
170
|
+
"drop_ratio": round(drop_ratio, 2),
|
|
171
|
+
"output_duration": round(out_dur, 2),
|
|
172
|
+
"segments_per_minute": round(spm, 2),
|
|
173
|
+
"max_gap_seconds": round(max_gap, 2),
|
|
174
|
+
"coverage": round(coverage, 2),
|
|
175
|
+
"clamped_count": len(clamped),
|
|
176
|
+
"warnings": warnings,
|
|
177
|
+
"blocking": any(w["code"] in blocking_codes for w in warnings),
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def update_cut_qc(plan, *, allow_duration_drift=False, duration_drift_allowed_by=None):
|
|
182
|
+
"""Populate clip_plan_validated.json['qc'] as the single cut QC source."""
|
|
183
|
+
qc = dict(plan.get("qc") or {})
|
|
184
|
+
warnings = list(qc.get("warnings") or [])
|
|
185
|
+
blocking = list(qc.get("blocking") or [])
|
|
186
|
+
total = float(plan.get("total_duration") or 0.0)
|
|
187
|
+
target = plan.get("target_duration")
|
|
188
|
+
if target in (None, ""):
|
|
189
|
+
target_status = "missing"
|
|
190
|
+
target_qc = {
|
|
191
|
+
"status": target_status,
|
|
192
|
+
"target_duration": None,
|
|
193
|
+
"total_duration": round(total, 3),
|
|
194
|
+
}
|
|
195
|
+
else:
|
|
196
|
+
target = float(target)
|
|
197
|
+
ratio = total / target if target > 0 else 0.0
|
|
198
|
+
if ratio < 0.85:
|
|
199
|
+
target_status = "under"
|
|
200
|
+
elif ratio > 1.15:
|
|
201
|
+
target_status = "over"
|
|
202
|
+
else:
|
|
203
|
+
target_status = "ok"
|
|
204
|
+
severity = None
|
|
205
|
+
if ratio < 0.60 or ratio > 1.40:
|
|
206
|
+
severity = "blocking"
|
|
207
|
+
elif target_status in {"under", "over"}:
|
|
208
|
+
severity = "warning"
|
|
209
|
+
target_qc = {
|
|
210
|
+
"status": target_status,
|
|
211
|
+
"target_duration": round(target, 3),
|
|
212
|
+
"total_duration": round(total, 3),
|
|
213
|
+
"ratio": round(ratio, 3),
|
|
214
|
+
"warning_thresholds": {"under": 0.85, "over": 1.15},
|
|
215
|
+
"blocking_thresholds": {"under": 0.60, "over": 1.40},
|
|
216
|
+
}
|
|
217
|
+
if severity:
|
|
218
|
+
warning = {
|
|
219
|
+
"code": "target_duration_drift",
|
|
220
|
+
"status": target_status,
|
|
221
|
+
"severity": "warning" if allow_duration_drift else severity,
|
|
222
|
+
"target_duration": round(target, 3),
|
|
223
|
+
"total_duration": round(total, 3),
|
|
224
|
+
"ratio": round(ratio, 3),
|
|
225
|
+
}
|
|
226
|
+
if allow_duration_drift:
|
|
227
|
+
warning["allowed"] = True
|
|
228
|
+
warning["duration_drift_allowed_by"] = (
|
|
229
|
+
duration_drift_allowed_by or "--allow-duration-drift"
|
|
230
|
+
)
|
|
231
|
+
target_qc["duration_drift_allowed_by"] = warning[
|
|
232
|
+
"duration_drift_allowed_by"
|
|
233
|
+
]
|
|
234
|
+
warnings.append(warning)
|
|
235
|
+
if severity == "blocking" and not allow_duration_drift:
|
|
236
|
+
blocking.append(warning)
|
|
237
|
+
qc["target_duration_status"] = target_status
|
|
238
|
+
qc["target_duration"] = target_qc
|
|
239
|
+
qc.setdefault("boundary_status", {})
|
|
240
|
+
qc["clip_count"] = len(plan.get("clips") or [])
|
|
241
|
+
qc["total_duration"] = round(total, 3)
|
|
242
|
+
if warnings:
|
|
243
|
+
qc["warnings"] = warnings
|
|
244
|
+
if blocking:
|
|
245
|
+
qc["blocking"] = blocking
|
|
246
|
+
elif "blocking" in qc:
|
|
247
|
+
qc.pop("blocking", None)
|
|
248
|
+
plan["qc"] = qc
|
|
249
|
+
return plan
|