feats: added renice module added jobs added ffmpeg command builders.

This commit is contained in:
Didier Slof 2023-05-06 23:21:12 +02:00
parent c43fd906cd
commit a905cdd4b9
Signed by: didier
GPG key ID: 01E71F18AA4398E5
10 changed files with 205 additions and 36 deletions

33
src/transcode/job.rs Normal file
View file

@ -0,0 +1,33 @@
use std::path::PathBuf;
use std::process::{Child, Command};
use crate::configuration::{Config, ConfigFFmpeg};
pub struct TranscodeJob {
pub input: String,
pub output: String
}
impl TranscodeJob {
pub fn new<S: Into<String>>(input: S, output: S) -> TranscodeJob {
TranscodeJob {
input: input.into(),
output: output.into()
}
}
pub fn build_command(&self, ffmpeg_config: &ConfigFFmpeg) -> Command {
let options = ffmpeg_config.build_command_options(&self.input, &self.output);
let mut command = Command::new("ffmpeg");
command.args(options.to_args());
command
}
pub fn check_if_exists(&self) -> bool {
std::path::Path::new(&self.output).exists()
}
pub fn run(&self, ffmpeg_config: &ConfigFFmpeg) -> Result<Child, std::io::Error> {
let mut command = self.build_command(ffmpeg_config);
command.spawn()
}
}

1
src/transcode/mod.rs Normal file
View file

@ -0,0 +1 @@
pub mod job;