Improve scan escalation, watch stability, and plan output

This commit is contained in:
2025-12-31 22:50:01 -05:00
parent 0e751a407d
commit a6cb9addb0
5 changed files with 93 additions and 6 deletions

View File

@@ -41,7 +41,7 @@ pub fn plan_fix(issues: &[Issue], policy: FixPolicy) -> FixPlan {
} else {
actions.push(FixAction {
kind,
command: Vec::new(),
command: command_template(kind),
destructive: true,
});
}
@@ -56,12 +56,52 @@ pub fn plan_fix(issues: &[Issue], policy: FixPolicy) -> FixPlan {
}
pub fn plan_outcome(plan: FixPlan) -> FixOutcome {
let message = if let Some(kind) = plan.recommended {
format!("Fix plan generated: {:?}", kind)
} else {
"Fix plan generated".to_string()
};
FixOutcome {
plan,
applied: false,
success: false,
message: "Fix plan generated".to_string(),
message,
output_path: None,
re_scan_required: false,
}
}
fn command_template(kind: FixKind) -> Vec<String> {
let mut cmd = vec![
"ffmpeg".to_string(),
"-v".to_string(),
"error".to_string(),
"-i".to_string(),
"<input>".to_string(),
];
match kind {
FixKind::Remux => {
cmd.push("-c".to_string());
cmd.push("copy".to_string());
}
FixKind::Faststart => {
cmd.push("-c".to_string());
cmd.push("copy".to_string());
cmd.push("-movflags".to_string());
cmd.push("+faststart".to_string());
}
FixKind::Reencode => {
cmd.push("-c:v".to_string());
cmd.push("libx264".to_string());
cmd.push("-c:a".to_string());
cmd.push("aac".to_string());
cmd.push("-movflags".to_string());
cmd.push("+faststart".to_string());
}
}
cmd.push("<output>".to_string());
cmd
}