case-insensitive extensions and explicit else arms
This commit is contained in:
+22
-13
@@ -994,7 +994,12 @@ fn clean_stale_palettes(dir: &Path) {
|
||||
if let Ok(entries) = std::fs::read_dir(dir) {
|
||||
for entry in entries.flatten() {
|
||||
if let Some(name) = entry.file_name().to_str() {
|
||||
if name.starts_with("preview-palette-") && name.ends_with(".png") {
|
||||
// Case-insensitive for the same reason as the temp sweep: these
|
||||
// are the app's own files, but Windows keeps the case it was given.
|
||||
let is_png = Path::new(name)
|
||||
.extension()
|
||||
.is_some_and(|e| e.eq_ignore_ascii_case("png"));
|
||||
if name.starts_with("preview-palette-") && is_png {
|
||||
drop(std::fs::remove_file(entry.path()));
|
||||
}
|
||||
}
|
||||
@@ -1249,19 +1254,23 @@ fn run_impl(
|
||||
let mut last_out_time_us: f64 = 0.0;
|
||||
for line in reader.lines().map_while(Result::ok) {
|
||||
if let Some((key, value)) = parse_progress_kv(&line) {
|
||||
if key == "out_time_us" {
|
||||
last_out_time_us = value;
|
||||
} else if key == "progress" {
|
||||
let percent = (last_out_time_us / encode_dur_us * 100.0).clamp(0.0, 100.0);
|
||||
if let Some(ref sender) = tx {
|
||||
// A dropped receiver means the frontend is gone;
|
||||
// the encode keeps running either way.
|
||||
let _ = sender.send(EncodeProgress {
|
||||
pass,
|
||||
total_passes,
|
||||
percent,
|
||||
});
|
||||
match key {
|
||||
"out_time_us" => last_out_time_us = value,
|
||||
"progress" => {
|
||||
let percent =
|
||||
(last_out_time_us / encode_dur_us * 100.0).clamp(0.0, 100.0);
|
||||
if let Some(ref sender) = tx {
|
||||
// A dropped receiver means the frontend is gone;
|
||||
// the encode keeps running either way.
|
||||
let _ = sender.send(EncodeProgress {
|
||||
pass,
|
||||
total_passes,
|
||||
percent,
|
||||
});
|
||||
}
|
||||
}
|
||||
// frame=, fps=, bitrate= and friends are not needed.
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user