feat: adiciona suporte para sobrescrever arquivos de saída no FFmpeg e atualiza ícones de estado na interface

This commit is contained in:
2026-02-28 20:53:19 -03:00
parent d69ce92e32
commit 3e38c51e3a
4 changed files with 12 additions and 7 deletions
+4
View File
@@ -14,6 +14,10 @@ impl FfmpegCommandBuilder {
pub fn build(project: &Project) -> Vec<String> { pub fn build(project: &Project) -> Vec<String> {
let mut args: Vec<String> = Vec::new(); let mut args: Vec<String> = Vec::new();
// Sobrescreve o arquivo de saída sem prompt interativo.
// Sem isso o FFmpeg aguarda [y/N] no stdin e o processo trava.
args.push("-y".to_string());
// ── Inputs ────────────────────────────────────────────────────────────── // ── Inputs ──────────────────────────────────────────────────────────────
// Input 0: arquivo fonte (sempre sem itsoffset próprio) // Input 0: arquivo fonte (sempre sem itsoffset próprio)
args.push("-i".to_string()); args.push("-i".to_string());
+1
View File
@@ -13,6 +13,7 @@ pub async fn run_ffmpeg_async(
) -> Result<()> { ) -> Result<()> {
let mut child = Command::new("ffmpeg") let mut child = Command::new("ffmpeg")
.args(&args) .args(&args)
.stdin(std::process::Stdio::null())
.stderr(std::process::Stdio::piped()) .stderr(std::process::Stdio::piped())
.stdout(std::process::Stdio::null()) .stdout(std::process::Stdio::null())
.spawn() .spawn()
+5 -5
View File
@@ -187,11 +187,11 @@ impl BatchPanel {
let (icon, color) = match &item.state { let (icon, color) = match &item.state {
ExecutionState::Idle => ("", egui::Color32::GRAY), ExecutionState::Idle => ("", egui::Color32::GRAY),
ExecutionState::Running => ("", egui::Color32::YELLOW), ExecutionState::Running => ("", egui::Color32::YELLOW),
ExecutionState::Success => ("", egui::Color32::GREEN), ExecutionState::Success => ("", egui::Color32::GREEN),
ExecutionState::Cancelled => { ExecutionState::Cancelled => {
("", egui::Color32::from_rgb(255, 200, 0)) ("", egui::Color32::from_rgb(255, 200, 0))
} }
ExecutionState::Error(_) => ("", egui::Color32::RED), ExecutionState::Error(_) => ("", egui::Color32::RED),
}; };
ui.colored_label(color, icon); ui.colored_label(color, icon);
ui.label(format!("#{}{} >> {}", idx + 1, source_name, output_name)); ui.label(format!("#{}{} >> {}", idx + 1, source_name, output_name));
@@ -300,7 +300,7 @@ impl BatchPanel {
events.push(BatchPanelEvent::ProcessAll); events.push(BatchPanelEvent::ProcessAll);
} }
} else if all_finished && !items.is_empty() { } else if all_finished && !items.is_empty() {
ui.colored_label(egui::Color32::GREEN, " Lote concluído."); ui.colored_label(egui::Color32::GREEN, " Lote concluído.");
} }
}); });
} }
@@ -483,9 +483,9 @@ impl BatchPanel {
let can_add = self.form_video.is_some() && self.form_output.is_some(); let can_add = self.form_video.is_some() && self.form_output.is_some();
let confirm_label = if is_edit { let confirm_label = if is_edit {
"Salvar alterações" "Salvar alterações"
} else { } else {
"Adicionar " "Adicionar ao carrinho"
}; };
if ui if ui
+2 -2
View File
@@ -76,13 +76,13 @@ impl ExecutionPanel {
ui.label("Processando..."); ui.label("Processando...");
} }
ExecutionState::Success => { ExecutionState::Success => {
ui.colored_label(egui::Color32::GREEN, " Arquivo gerado com sucesso!"); ui.colored_label(egui::Color32::GREEN, " Arquivo gerado com sucesso!");
} }
ExecutionState::Cancelled => { ExecutionState::Cancelled => {
ui.colored_label(egui::Color32::YELLOW, "⊘ Geração cancelada pelo usuário."); ui.colored_label(egui::Color32::YELLOW, "⊘ Geração cancelada pelo usuário.");
} }
ExecutionState::Error(msg) => { ExecutionState::Error(msg) => {
ui.colored_label(egui::Color32::RED, " Erro durante o processamento:"); ui.colored_label(egui::Color32::RED, " Erro durante o processamento:");
ui.add( ui.add(
egui::TextEdit::multiline(&mut msg.as_str()) egui::TextEdit::multiline(&mut msg.as_str())
.desired_rows(4) .desired_rows(4)