(
file: Option<String>,
webcam: Option<Option<String>>,
placeholder: bool,
)
| 5534 | } |
| 5535 | |
| 5536 | fn camera_source_from_args( |
| 5537 | file: Option<String>, |
| 5538 | webcam: Option<Option<String>>, |
| 5539 | placeholder: bool, |
| 5540 | ) -> anyhow::Result<camera::CameraSource> { |
| 5541 | let source_count = |
| 5542 | usize::from(file.is_some()) + usize::from(webcam.is_some()) + usize::from(placeholder); |
| 5543 | if source_count > 1 { |
| 5544 | return Err(crate::error::AppError::bad_request( |
| 5545 | "Choose only one camera source: --file, --webcam, or --placeholder.", |
| 5546 | ) |
| 5547 | .into()); |
| 5548 | } |
| 5549 | if let Some(file) = file { |
| 5550 | return Ok(camera::file_source(file.trim())); |
| 5551 | } |
| 5552 | if let Some(webcam) = webcam { |
| 5553 | return Ok(camera::CameraSource { |
| 5554 | kind: camera::CameraSourceKind::Webcam, |
| 5555 | arg: webcam.and_then(|value| { |
| 5556 | let trimmed = value.trim().to_owned(); |
| 5557 | (!trimmed.is_empty()).then_some(trimmed) |
| 5558 | }), |
| 5559 | }); |
| 5560 | } |
| 5561 | Ok(camera::CameraSource::default()) |
| 5562 | } |
| 5563 | |
| 5564 | fn default_screenshot_path(udid: &str) -> PathBuf { |
| 5565 | let timestamp = std::time::SystemTime::now() |
no test coverage detected