fix(config): made process part optional
This commit is contained in:
parent
fe55238b10
commit
205380b689
2 changed files with 12 additions and 10 deletions
|
@ -67,7 +67,7 @@ pub struct ConfigFFmpeg {
|
||||||
pub path: String,
|
pub path: String,
|
||||||
pub extra_args: Option<Vec<String>>,
|
pub extra_args: Option<Vec<String>>,
|
||||||
pub overwrite: Option<bool>,
|
pub overwrite: Option<bool>,
|
||||||
pub process: ConfigFFmpegProcess,
|
pub process: Option<ConfigFFmpegProcess>,
|
||||||
pub output: ConfigFFmpegOutput,
|
pub output: ConfigFFmpegOutput,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,16 +86,16 @@ impl Config {
|
||||||
input_path: String::from("/data/input"),
|
input_path: String::from("/data/input"),
|
||||||
output_path: String::from("/data/output"),
|
output_path: String::from("/data/output"),
|
||||||
include: Vec::new(),
|
include: Vec::new(),
|
||||||
cleanup: None
|
cleanup: None,
|
||||||
},
|
},
|
||||||
ffmpeg: ConfigFFmpeg {
|
ffmpeg: ConfigFFmpeg {
|
||||||
path: String::from("/usr/bin/ffmpeg"),
|
path: String::from("/usr/bin/ffmpeg"),
|
||||||
extra_args: None,
|
extra_args: None,
|
||||||
overwrite: None,
|
overwrite: None,
|
||||||
process: ConfigFFmpegProcess {
|
process: Some(ConfigFFmpegProcess {
|
||||||
threads: Some(0),
|
threads: Some(0),
|
||||||
niceness: Some(0),
|
niceness: Some(0),
|
||||||
},
|
}),
|
||||||
output: ConfigFFmpegOutput {
|
output: ConfigFFmpegOutput {
|
||||||
format: String::from("webm"),
|
format: String::from("webm"),
|
||||||
video: ConfigFFmpegOutputVideo {
|
video: ConfigFFmpegOutputVideo {
|
||||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -43,7 +43,7 @@ fn main() {
|
||||||
|
|
||||||
let job = TranscodeJob::new(
|
let job = TranscodeJob::new(
|
||||||
file.to_str().unwrap(),
|
file.to_str().unwrap(),
|
||||||
output_path.to_str().unwrap()
|
output_path.to_str().unwrap(),
|
||||||
);
|
);
|
||||||
|
|
||||||
// check if overwriting
|
// check if overwriting
|
||||||
|
@ -64,14 +64,16 @@ fn main() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (config.ffmpeg.process.niceness.unwrap_or(0)) > 0 {
|
if let Some(process) = &config.ffmpeg.process {
|
||||||
match renice(child.id(), config.ffmpeg.process.niceness.unwrap()) {
|
if (process.niceness.unwrap_or(0)) > 0 {
|
||||||
Ok(_) => {},
|
match renice(child.id(), process.niceness.unwrap_or(0)) {
|
||||||
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Failed to renice ffmpeg process: {}", e);
|
error!("Failed to renice ffmpeg process: {}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Err(e) = child.wait() {
|
if let Err(e) = child.wait() {
|
||||||
fail(&job, &format!("Failed to wait for ffmpeg process: {}", e));
|
fail(&job, &format!("Failed to wait for ffmpeg process: {}", e));
|
||||||
|
|
Loading…
Reference in a new issue