Skip to content

利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.

fix(cli): allow the zoom video transition modes

c020627e021e639d315
diff --git a/cli.py b/cli.py
index 0f763275..6c0f3ff1 100644
--- a/cli.py
+++ b/cli.py
@@ -140,6 +140,8 @@ _TRANSITION_MODE_VALUES = {
"fade-out": "FadeOut",
"slide-in": "SlideIn",
"slide-out": "SlideOut",
+ "zoom-in": "ZoomIn",
+ "zoom-out": "ZoomOut",
}
@@ -353,7 +355,7 @@ Batch manifests:
"--video-transition-mode",
type=_transition_mode,
default=None,
- metavar="{none,shuffle,fade-in,fade-out,slide-in,slide-out}",
+ metavar="{none,shuffle,fade-in,fade-out,slide-in,slide-out,zoom-in,zoom-out}",
help="transition applied between source clips (default: none)",
)
video_group.add_argument(
diff --git a/test/services/test_cli.py b/test/services/test_cli.py
index cdbcc8e9..de79e8e3 100644
--- a/test/services/test_cli.py
+++ b/test/services/test_cli.py
@@ -14,6 +14,7 @@ sys.path.insert(0, str(Path(__file__).parent.parent.parent))
import cli
from app.config import config as app_config
+from app.models.schema import VideoTransitionMode
class TestCli(unittest.TestCase):
@@ -50,6 +51,26 @@ class TestCli(unittest.TestCase):
self.assertEqual(default_params.video_fit_mode.value, "cover")
self.assertEqual(contain_params.video_fit_mode.value, "contain")
+ def test_zoom_transition_modes_are_reachable_from_the_cli(self):
+ # Every transition the render pipeline understands must also be
+ # selectable from the CLI. Deriving the expectation from the enum stops
+ # the two lists from drifting apart again.
+ cli_modes = set(cli._TRANSITION_MODE_VALUES.values()) - {None}
+ pipeline_modes = {
+ mode.value
+ for mode in VideoTransitionMode
+ if mode is not VideoTransitionMode.none
+ }
+ self.assertEqual(cli_modes, pipeline_modes)
+
+ zoom_params = cli.build_video_params(
+ cli.parse_args(
+ ["--video-subject", "test", "--video-transition-mode", "zoom-in"]
+ )
+ )
+
+ self.assertEqual(zoom_params.video_transition_mode.value, "ZoomIn")
+
def test_complete_script_can_replace_video_subject(self):
args = cli.parse_args(["--video-script", "完整的视频文案"])
params = cli.build_video_params(args)