From f68806d8149c2252157df9d881b099689ce61a70 Mon Sep 17 00:00:00 2001 From: Didier Date: Mon, 8 May 2023 10:42:14 +0200 Subject: [PATCH] fix(config): made ffmpeg config section more optional --- src/configuration/ffmpeg.rs | 2 +- src/configuration/mod.rs | 2 +- src/ffmpeg.rs | 4 ++-- src/transcode/job.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/configuration/ffmpeg.rs b/src/configuration/ffmpeg.rs index 23e4f7d..3538dfa 100644 --- a/src/configuration/ffmpeg.rs +++ b/src/configuration/ffmpeg.rs @@ -28,7 +28,7 @@ pub struct ConfigFFmpegOutput { #[derive(Serialize, Deserialize, Debug)] pub struct ConfigFFmpeg { - pub path: String, + pub path: Option, pub extra_args: Option>, pub overwrite: Option, pub process: Option, diff --git a/src/configuration/mod.rs b/src/configuration/mod.rs index b887d4b..847ab82 100644 --- a/src/configuration/mod.rs +++ b/src/configuration/mod.rs @@ -54,7 +54,7 @@ impl Config { cleanup: None, }, ffmpeg: ffmpeg::ConfigFFmpeg { - path: String::from("/usr/bin/ffmpeg"), + path: Some(String::from("/usr/bin/ffmpeg")), extra_args: None, overwrite: None, process: Some(ffmpeg::ConfigFFmpegProcess { diff --git a/src/ffmpeg.rs b/src/ffmpeg.rs index 0649c94..af6ad68 100644 --- a/src/ffmpeg.rs +++ b/src/ffmpeg.rs @@ -66,8 +66,8 @@ impl FFmpegCommandOptions { args } - pub fn to_command(&self, ffmpeg_path: &str) -> Command { - let mut command = Command::new(ffmpeg_path); + pub fn to_command>(&self, ffmpeg_path: S) -> Command { + let mut command = Command::new(ffmpeg_path.into()); command.args(self.to_args()); command } diff --git a/src/transcode/job.rs b/src/transcode/job.rs index 978e139..c7b5019 100644 --- a/src/transcode/job.rs +++ b/src/transcode/job.rs @@ -19,7 +19,7 @@ impl TranscodeJob { pub fn build_command(&self, ffmpeg_config: &ConfigFFmpeg) -> Command { ffmpeg_config .build_command_options(&self.input, &self.output) - .to_command(&ffmpeg_config.path) + .to_command(&ffmpeg_config.path.clone().unwrap_or("ffmpeg".to_string())) } pub fn check_if_exists(&self) -> bool {