MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / _burst

Function _burst

unity_cli/cli/commands/screenshot.py:146–192  ·  view source on GitHub ↗
(
    ctx: typer.Context,
    count: int,
    interval_ms: int,
    format: str,
    quality: int,
    width: int | None,
    height: int | None,
    camera_name: str | None,
    output_dir: str | None,
    json_flag: bool,
)

Source from the content-addressed store, hash-verified

144
145
146def _burst(
147 ctx: typer.Context,
148 count: int,
149 interval_ms: int,
150 format: str,
151 quality: int,
152 width: int | None,
153 height: int | None,
154 camera_name: str | None,
155 output_dir: str | None,
156 json_flag: bool,
157) -> None:
158 context: CLIContext = ctx.obj
159
160 if format not in ("png", "jpg"):
161 print_error(f"Invalid format: {format}. Use 'png' or 'jpg'", "INVALID_FORMAT")
162 raise typer.Exit(ExitCode.USAGE_ERROR) from None
163
164 try:
165 result = context.client.screenshot.burst(
166 count=count,
167 interval_ms=interval_ms,
168 format=format, # type: ignore[arg-type]
169 quality=quality,
170 width=width or 1920,
171 height=height or 1080,
172 camera=camera_name,
173 output_dir=output_dir,
174 )
175
176 if _should_json(context, json_flag):
177 print_json(result)
178 return
179
180 if get_output_mode() is not OutputMode.PRETTY:
181 print(result.get("outputDir", ""))
182 return
183
184 frame_count = result.get("frameCount", 0)
185 elapsed = result.get("elapsed", 0)
186 fps = result.get("fps", 0)
187 out_dir = result.get("outputDir", "")
188 print_success(f"Burst capture: {frame_count} frames in {elapsed}s ({fps} FPS)")
189 print_line(f"[dim]Output: {escape(str(out_dir))}[/dim]")
190
191 except UnityCLIError as e:
192 _handle_error(e)

Callers 1

screenshotFunction · 0.85

Calls 10

print_errorFunction · 0.90
_should_jsonFunction · 0.90
print_jsonFunction · 0.90
get_output_modeFunction · 0.90
print_successFunction · 0.90
print_lineFunction · 0.90
_handle_errorFunction · 0.90
ExitMethod · 0.80
burstMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected