v 0.1.1
This commit is contained in:
10
src/main.rs
10
src/main.rs
@@ -357,10 +357,12 @@ async fn process_nexrender_jobs(workbook: &ExcelWorkbook, config: &Config) -> Re
|
||||
for job in jobs {
|
||||
let client = http_client.clone();
|
||||
let api_url = config.nexrender_api_url.clone();
|
||||
let output_folder = config.output_folder.clone();
|
||||
let config_clone = config.clone(); // ✅ Клонируем весь конфиг
|
||||
|
||||
tasks.push(tokio::spawn(async move {
|
||||
let nexrender_job = job.to_nexrender_job(&output_folder);
|
||||
let nexrender_job = job.to_nexrender_job(&config_clone); // ✅ Передаём Config
|
||||
info!("Submitting job: {}", job.outfile_name);
|
||||
|
||||
let response = client.post(&api_url).json(&nexrender_job).send().await?;
|
||||
|
||||
if response.status().is_success() {
|
||||
@@ -371,7 +373,9 @@ async fn process_nexrender_jobs(workbook: &ExcelWorkbook, config: &Config) -> Re
|
||||
Ok(None)
|
||||
}
|
||||
} else {
|
||||
error!("Failed to submit job: {}", job.outfile_name);
|
||||
let status = response.status();
|
||||
let text = response.text().await.unwrap_or_default();
|
||||
error!("Failed to submit job ({}): {}", status, text);
|
||||
Ok(None)
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -90,22 +90,32 @@ pub struct Template {
|
||||
pub output_ext: String,
|
||||
}
|
||||
|
||||
impl Default for Template {
|
||||
fn default() -> Self {
|
||||
impl Template {
|
||||
pub fn double(
|
||||
src: String,
|
||||
composition: String,
|
||||
output_module: String,
|
||||
output_ext: String,
|
||||
) -> Self {
|
||||
Self {
|
||||
src: "file:///c:/users/virtVmix-2/Downloads/PackShot_DOUBLE.aepx".to_string(),
|
||||
composition: "pack".to_string(),
|
||||
output_module: "Start_h264".to_string(),
|
||||
output_ext: "mp4".to_string(),
|
||||
src,
|
||||
composition,
|
||||
output_module,
|
||||
output_ext,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Template {
|
||||
pub fn single() -> Self {
|
||||
pub fn single(
|
||||
src: String,
|
||||
composition: String,
|
||||
output_module: String,
|
||||
output_ext: String,
|
||||
) -> Self {
|
||||
Self {
|
||||
src: "file:///c:/users/virtVmix-2/Downloads/PackShot_SINGLE.aepx".to_string(),
|
||||
..Default::default()
|
||||
src,
|
||||
composition,
|
||||
output_module,
|
||||
output_ext,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,17 +302,32 @@ impl JobData {
|
||||
variants
|
||||
}
|
||||
|
||||
pub fn to_nexrender_job(&self, output_folder: &str) -> NexrenderJob {
|
||||
// ЕДИНСТВЕННАЯ реализация метода
|
||||
pub fn to_nexrender_job(&self, config: &crate::config::Config) -> NexrenderJob {
|
||||
let template = if self.team_b.is_empty() {
|
||||
Template::single()
|
||||
Template::single(
|
||||
config.template_single_src.clone(),
|
||||
config.template_composition.clone(),
|
||||
config.template_output_module.clone(),
|
||||
config.template_output_ext.clone(),
|
||||
)
|
||||
} else {
|
||||
Template::default()
|
||||
Template::double(
|
||||
config.template_double_src.clone(),
|
||||
config.template_composition.clone(),
|
||||
config.template_output_module.clone(),
|
||||
config.template_output_ext.clone(),
|
||||
)
|
||||
};
|
||||
|
||||
let output_path = format!("{}/{}.mp4", output_folder, self.outfile_name);
|
||||
let output_path = format!(
|
||||
"{}/{}.{}",
|
||||
config.output_folder, self.outfile_name, config.template_output_ext
|
||||
);
|
||||
|
||||
let mut actions = Actions::default();
|
||||
actions.postrender.push(PostrenderAction::Copy {
|
||||
input: "encoded.mp4".to_string(),
|
||||
input: format!("encoded.{}", config.template_output_ext),
|
||||
output: output_path,
|
||||
});
|
||||
|
||||
@@ -503,16 +528,16 @@ impl LogoRegistry {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, team: String, sport: String, link: String) {
|
||||
self.logos.insert((team, sport), link);
|
||||
}
|
||||
|
||||
pub fn with_capacity(capacity: usize) -> Self {
|
||||
Self {
|
||||
logos: HashMap::with_capacity(capacity),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, team: String, sport: String, link: String) {
|
||||
self.logos.insert((team, sport), link);
|
||||
}
|
||||
|
||||
pub fn find(&self, team: &str, sport: &str) -> Option<String> {
|
||||
if let Some(link) = self.logos.get(&(team.to_string(), sport.to_string())) {
|
||||
return Some(link.clone());
|
||||
|
||||
Reference in New Issue
Block a user