Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

style: rustfmt the filmstrip windows

Jareer21c76daa6f13
diff --git a/engine/crates/concat-host/src/media.rs b/engine/crates/concat-host/src/media.rs
index e4a60eae..d9a8b2a2 100644
--- a/engine/crates/concat-host/src/media.rs
+++ b/engine/crates/concat-host/src/media.rs
@@ -484,7 +484,9 @@ fn read_through(
}
// Past the last frame - a duration the container overstated - the last
// picture stands for what is left; the caller spreads it.
- if index < count && let Some(frame) = last {
+ if index < count
+ && let Some(frame) = last
+ {
tiles[index] = Some(frame);
}
Ok(())
@@ -570,8 +572,14 @@ mod window_tests {
let (level, cell) = strip_window(start, span, duration).expect("a cell");
let from = window_start(level, cell);
let to = from + window_span(level);
- assert!(from <= start && start + span <= to + 1e-12, "{start} {span} at {level}/{cell}");
- assert!(to <= 1.0 + 1e-12, "cell {level}/{cell} runs past the footage");
+ assert!(
+ from <= start && start + span <= to + 1e-12,
+ "{start} {span} at {level}/{cell}"
+ );
+ assert!(
+ to <= 1.0 + 1e-12,
+ "cell {level}/{cell} runs past the footage"
+ );
// and, short of the cap, the cut is at least a quarter of
// it: the cell is the finest whose half still holds the cut
let finest = duration.log2().floor() as u32;
@@ -596,7 +604,10 @@ mod window_tests {
// 10s of footage: a cell no shorter than a second is level 3
assert_eq!(strip_window(0.0, 1e-6, 10.0), Some((3, 0)));
// and a day of footage stops at WINDOW_LEVELS
- assert_eq!(strip_window(0.0, 1e-9, 86400.0).map(|(level, _)| level), Some(WINDOW_LEVELS));
+ assert_eq!(
+ strip_window(0.0, 1e-9, 86400.0).map(|(level, _)| level),
+ Some(WINDOW_LEVELS)
+ );
}
}
diff --git a/engine/crates/concat/src/host.rs b/engine/crates/concat/src/host.rs
index 20b391f9..d0aad917 100644
--- a/engine/crates/concat/src/host.rs
+++ b/engine/crates/concat/src/host.rs
@@ -17,10 +17,10 @@ use std::rc::Rc;
use std::sync::{Arc, Condvar, Mutex, OnceLock};
use concat_host::export::Exporter;
+pub use concat_host::media::{strip_window, window_span, window_start};
use concat_host::playback::{Playback, PlaybackEvents};
use concat_host::preview::Monitor;
use concat_host::{AppDirs, media};
-pub use concat_host::media::{strip_window, window_span, window_start};
use concat_speech::{Speech, Transcriber};
use crate::gpu::Gpu;
@@ -454,25 +454,28 @@ pub fn cached_window_art(
let dir = art_cache_dir(project);
let stem = art_cache_stem(id, path);
let prefix = format!("{stem}.win.{level}.{cell}.");
- std::fs::read_dir(&dir).ok()?.filter_map(Result::ok).find_map(|entry| {
- let name = entry.file_name();
- let name = name.to_str()?;
- let rest = name.strip_prefix(&prefix)?.strip_suffix(".jpg")?;
- let mut parts = rest.split('.');
- let frames: u32 = parts.next()?.parse().ok()?;
- let frame_width: u32 = parts.next()?.parse().ok()?;
- let height: u32 = parts.next()?.parse().ok()?;
- if parts.next().is_some() {
- return None;
- }
- let image = image_at(&entry.path())?;
- Some(CachedStrip {
- image,
- frames,
- frame_width,
- height,
+ std::fs::read_dir(&dir)
+ .ok()?
+ .filter_map(Result::ok)
+ .find_map(|entry| {
+ let name = entry.file_name();
+ let name = name.to_str()?;
+ let rest = name.strip_prefix(&prefix)?.strip_suffix(".jpg")?;
+ let mut parts = rest.split('.');
+ let frames: u32 = parts.next()?.parse().ok()?;
+ let frame_width: u32 = parts.next()?.parse().ok()?;
+ let height: u32 = parts.next()?.parse().ok()?;
+ if parts.next().is_some() {
+ return None;
+ }
+ let image = image_at(&entry.path())?;
+ Some(CachedStrip {
+ image,
+ frames,
+ frame_width,
+ height,
+ })
})
- })
}
fn save_window_art_cache(
diff --git a/engine/crates/concat/src/studio.rs b/engine/crates/concat/src/studio.rs
index 65fcf797..11f67e93 100644
--- a/engine/crates/concat/src/studio.rs
+++ b/engine/crates/concat/src/studio.rs
@@ -2334,7 +2334,9 @@ impl Studio {
studio.thumbs.insert(art.id.clone(), image_of(&frame));
}
if let Some((frame, frames)) = art.strip {
- studio.strips.insert(art.id.clone(), Strip::of(&frame, frames));
+ studio
+ .strips
+ .insert(art.id.clone(), Strip::of(&frame, frames));
}
if let Some(peaks) = art.peaks {
let prefix = format!("{key}|");