The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
feat: Clear project cache command in the File menu
Domica7e45ae83a7ae
diff --git a/engine/crates/concat-host/src/projects.rs b/engine/crates/concat-host/src/projects.rsindex dc4bcdbf..bb5f9e56 100644--- a/engine/crates/concat-host/src/projects.rs+++ b/engine/crates/concat-host/src/projects.rs@@ -384,3 +384,33 @@ mod tests {assert!(!same_path("D:\\Work\\Film", "D:\\Work\\Other"));}}++/// Removes all cached artwork and waveforms from a project folder.+///+/// The cache is entirely regenerable, so the whole folder goes, subfolders+/// (`art/`, peaks and all) included. `remove_file` alone would skip them:+/// it refuses directories.+pub fn clear_cache(path: &str) -> Result<usize, String> {+ let cache_dir = Path::new(path).join("cache");+ if !cache_dir.exists() {+ return Ok(0);+ }+ let count = count_files(&cache_dir);+ std::fs::remove_dir_all(&cache_dir)+ .map_err(|error| format!("cannot remove {}: {error}", cache_dir.display()))?;+ Ok(count)+}++/// Recursively counts the files under a directory, for the clear-cache toast.+fn count_files(dir: &Path) -> usize {+ let Ok(entries) = std::fs::read_dir(dir) else {+ return 0;+ };+ entries+ .filter_map(|entry| entry.ok())+ .map(|entry| {+ let path = entry.path();+ if path.is_dir() { count_files(&path) } else { 1 }+ })+ .sum()+}diff --git a/engine/crates/concat/locales/en.json b/engine/crates/concat/locales/en.jsonindex 8edca896..d515d14e 100644--- a/engine/crates/concat/locales/en.json+++ b/engine/crates/concat/locales/en.json@@ -112,6 +112,7 @@"Cinematic": "Cinematic","Clarity": "Clarity","Clean": "Clean",+ "Clear project cache": "Clear project cache","Clears the room out of a recording: rumble, hiss, sibilance and uneven level.": "Clears the room out of a recording: rumble, hiss, sibilance and uneven level.","Clips": "Clips","Close project": "Close project",diff --git a/engine/crates/concat/src/lib.rs b/engine/crates/concat/src/lib.rsindex 7d25f53b..8c136602 100644--- a/engine/crates/concat/src/lib.rs+++ b/engine/crates/concat/src/lib.rs@@ -1045,7 +1045,7 @@ pub fn run() -> Result<(), slint::PlatformError> {"open" => {if let Some(path) = platform::pick_folder(&i18n::t("Open project"), ""){- let concat_json = path.join("concat.json");+ let concat_json = path.join("concat.json");if concat_json.exists() {state.open_recent(&path.to_string_lossy());} else {@@ -1067,6 +1067,7 @@ pub fn run() -> Result<(), slint::PlatformError> {}"template" => state.save_template(),"speech" => state.speech_open(),+ "clear-cache" => state.clear_project_cache(),"settings" => {state.refresh_models();state.settings.open = true;diff --git a/engine/crates/concat/src/studio.rs b/engine/crates/concat/src/studio.rsindex 446df502..5ab64fd6 100644--- a/engine/crates/concat/src/studio.rs+++ b/engine/crates/concat/src/studio.rs@@ -4740,6 +4740,23 @@ impl Studio {}}+ /// Clears all cached artwork and waveforms from the current project.+ pub fn clear_project_cache(&mut self) {+ let Some(path) = self+ .session+ .as_ref()+ .map(|session| session.path().to_string())+ else {+ return;+ };+ match concat_host::projects::clear_cache(&path) {+ Ok(count) => self.notify(&format!("Cleared {count} cache files"), false),+ Err(error) => self.notify(&format!("Cache clear failed: {error}"), true),+ }+ self.request_media_art();+ self.request_preview();+ }+pub fn forget_recent(&mut self, path: &str) {if let Err(error) = projects::forget(&self.host.dirs.config, path) {self.start.error = error;@@ -6842,6 +6859,13 @@ impl Studio {),row("template", t("Save as template…"), Glyph::Slot, "", true),row("speech", t("Text to speech…"), Glyph::Volume, "", true),+ row(+ "clear-cache",+ t("Clear project cache"),+ Glyph::None,+ "",+ true,+ ),rule(),row("settings", t("Settings…"), Glyph::Settings, "⌘,", true),rule(),