[feat] integrate global progress manager for unified log handling; enhance model download workflow with progress tracking and SHA-256 verification
This commit is contained in:
34
src/main.rs
34
src/main.rs
@@ -291,9 +291,27 @@ fn run() -> Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
// Handle model management modes early and exit
|
||||
if args.download_models && args.update_models {
|
||||
// Avoid ambiguous behavior when both flags are set
|
||||
return Err(anyhow!("Choose only one: --download-models or --update-models"));
|
||||
}
|
||||
if args.download_models {
|
||||
// Launch interactive model downloader and exit
|
||||
polyscribe::models::run_interactive_model_downloader()?;
|
||||
return Ok(());
|
||||
}
|
||||
if args.update_models {
|
||||
// Update existing local models and exit
|
||||
polyscribe::models::update_local_models()?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Prefer Config-driven progress factory
|
||||
let pf = ProgressFactory::from_config(&config);
|
||||
let pm = pf.make_manager(pf.decide_mode(args.inputs.len()));
|
||||
// Route subsequent INFO/WARN/DEBUG logs through the cliclack/indicatif area
|
||||
polyscribe::progress::set_global_progress_manager(&pm);
|
||||
|
||||
// Determine formats
|
||||
let out_formats = if args.out_format.is_empty() {
|
||||
@@ -313,7 +331,8 @@ fn run() -> Result<()> {
|
||||
|
||||
let do_merge = args.merge || args.merge_and_separate;
|
||||
if polyscribe::verbose_level() >= 1 && !args.quiet {
|
||||
eprintln!("Mode: {}", if do_merge { "merge" } else { "separate" });
|
||||
// Render mode information inside the progress/cliclack area
|
||||
polyscribe::ilog!("Mode: {}", if do_merge { "merge" } else { "separate" });
|
||||
}
|
||||
|
||||
// Collect inputs and default speakers
|
||||
@@ -459,12 +478,13 @@ fn run() -> Result<()> {
|
||||
|
||||
// Emit totals and summary to stderr unless quiet
|
||||
if !polyscribe::is_quiet() {
|
||||
eprintln!("INFO: Total: {}/{} processed", summary.len(), plan.len());
|
||||
eprintln!("Summary:");
|
||||
for line in render_summary_lines(&summary) { eprintln!("{}", line); }
|
||||
for (_, _, ok, _) in &summary { if !ok { eprintln!("ERR"); } }
|
||||
eprintln!();
|
||||
if had_error { eprintln!("ERROR: One or more inputs failed"); }
|
||||
// Print inside the progress/cliclack area
|
||||
polyscribe::ilog!("Total: {}/{} processed", summary.len(), plan.len());
|
||||
polyscribe::ilog!("Summary:");
|
||||
for line in render_summary_lines(&summary) { polyscribe::ilog!("{}", line); }
|
||||
for (_, _, ok, _) in &summary { if !ok { polyscribe::elog!("ERR"); } }
|
||||
polyscribe::ilog!("");
|
||||
if had_error { polyscribe::elog!("One or more inputs failed"); }
|
||||
}
|
||||
|
||||
if had_error { std::process::exit(2); }
|
||||
|
Reference in New Issue
Block a user