improve cache size calculation by filtering file types

This commit is contained in:
Boody
2026-07-29 12:47:55 +03:00
parent d183fe545b
commit 2e631ad816
+2 -2
View File
@@ -107,9 +107,9 @@ class TTSService:
total_size = 0 total_size = 0
# Safely scan files and sum sizes, ignoring files deleted mid-scan # 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: try:
if f.is_file(): if f.is_file() and f.suffix.lower() in (".mp3", ".wav"):
files.append(f) files.append(f)
total_size += f.stat().st_size total_size += f.stat().st_size
except OSError: except OSError: