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)] #[derive(Serialize, Deserialize, Debug)]
pub struct ConfigFFmpeg { pub struct ConfigFFmpeg {
pub path: String, pub path: Option<String>,
pub extra_args: Option<Vec<String>>, pub extra_args: Option<Vec<String>>,
pub overwrite: Option<bool>, pub overwrite: Option<bool>,
pub process: Option<ConfigFFmpegProcess>, pub process: Option<ConfigFFmpegProcess>,

View file

@ -54,7 +54,7 @@ impl Config {
cleanup: None, cleanup: None,
}, },
ffmpeg: ffmpeg::ConfigFFmpeg { ffmpeg: ffmpeg::ConfigFFmpeg {
path: String::from("/usr/bin/ffmpeg"), path: Some(String::from("/usr/bin/ffmpeg")),
extra_args: None, extra_args: None,
overwrite: None, overwrite: None,
process: Some(ffmpeg::ConfigFFmpegProcess { process: Some(ffmpeg::ConfigFFmpegProcess {

View file

@ -66,8 +66,8 @@ impl FFmpegCommandOptions {
args args
} }
pub fn to_command(&self, ffmpeg_path: &str) -> Command { pub fn to_command<S: Into<String>>(&self, ffmpeg_path: S) -> Command {
let mut command = Command::new(ffmpeg_path); let mut command = Command::new(ffmpeg_path.into());
command.args(self.to_args()); command.args(self.to_args());
command command
} }

View file

@ -19,7 +19,7 @@ impl TranscodeJob {
pub fn build_command(&self, ffmpeg_config: &ConfigFFmpeg) -> Command { pub fn build_command(&self, ffmpeg_config: &ConfigFFmpeg) -> Command {
ffmpeg_config ffmpeg_config
.build_command_options(&self.input, &self.output) .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 { pub fn check_if_exists(&self) -> bool {