fix(config): made ffmpeg config section more optional

This commit is contained in:
Didier Slof 2023-05-08 10:42:14 +02:00
parent 05848b6701
commit f68806d814
Signed by: didier
GPG Key ID: 01E71F18AA4398E5
4 changed files with 5 additions and 5 deletions

View File

@ -28,7 +28,7 @@ pub struct ConfigFFmpegOutput {
#[derive(Serialize, Deserialize, Debug)]
pub struct ConfigFFmpeg {
pub path: String,
pub path: Option<String>,
pub extra_args: Option<Vec<String>>,
pub overwrite: Option<bool>,
pub process: Option<ConfigFFmpegProcess>,

View File

@ -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 {

View File

@ -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<S: Into<String>>(&self, ffmpeg_path: S) -> Command {
let mut command = Command::new(ffmpeg_path.into());
command.args(self.to_args());
command
}

View File

@ -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 {