利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.
Python ai-video-generatorcontent-creationffmpeginstagram-reelsllmpythonshort-videosubtitlestext-to-speechtiktokvideo-automationvideo-workflowworkflow-automationyoutube-shorts
fix(cli): validate --video-source local constraints at parse time (#1033)
kapil971390ca3785e4ddf8
diff --git a/cli.py b/cli.pyindex 611e2b08..18227ba3 100644--- a/cli.py+++ b/cli.py@@ -52,7 +52,18 @@ def parse_args(argv: Sequence[str] | None = None) -> argparse.Namespace:help="enable subtitles (default: enabled, use --no-subtitle-enabled to disable)",)parser.add_argument("--task-id", default="", help="custom task id")- return parser.parse_args(argv)+ args = parser.parse_args(argv)++ if args.video_source == "local" and not (args.video_materials or "").strip():+ parser.error("--video-materials is required when --video-source is local")++ if args.video_source == "local" and args.stop_at == "terms":+ parser.error(+ "--stop-at terms has no effect with --video-source local "+ "(search terms are not generated for local sources)"+ )++ return argsdef build_video_params(args: argparse.Namespace) -> VideoParams:diff --git a/test/services/test_cli.py b/test/services/test_cli.pyindex 81fcb0a1..ba76a54b 100644--- a/test/services/test_cli.py+++ b/test/services/test_cli.py@@ -105,5 +105,21 @@ class TestCli(unittest.TestCase):os.remove(test_filepath)+ def test_local_source_requires_video_materials(self):+ with self.assertRaises(SystemExit) as cm:+ cli.parse_args(["--video-subject", "test", "--video-source", "local"])+ self.assertNotEqual(cm.exception.code, 0)++ def test_local_source_stop_at_terms_rejected(self):+ with self.assertRaises(SystemExit) as cm:+ cli.parse_args([+ "--video-subject", "test",+ "--video-source", "local",+ "--video-materials", "a.mp4",+ "--stop-at", "terms",+ ])+ self.assertNotEqual(cm.exception.code, 0)++if __name__ == "__main__":unittest.main()