Skip to content

Self-hosted AI workspace.

Python

improve cache size calculation by filtering file types

Boody2e631ad8160c
diff --git a/services/tts/tts_service.py b/services/tts/tts_service.py
index c7f787954..dd37865a7 100644
--- a/services/tts/tts_service.py
+++ b/services/tts/tts_service.py
@@ -107,9 +107,9 @@ class TTSService:
total_size = 0
# Safely scan files and sum sizes, ignoring files deleted mid-scan
- for f in self.cache_dir.glob("*.*"):
+ for f in self.cache_dir.iterdir():
try:
- if f.is_file():
+ if f.is_file() and f.suffix.lower() in (".mp3", ".wav"):
files.append(f)
total_size += f.stat().st_size
except OSError: