feat: Add TTS statistics endpoint and service method for comprehensive TTS data

This commit is contained in:
JSC
2025-09-27 21:37:59 +02:00
parent 7b59a8216a
commit d9697c2dd7
3 changed files with 33 additions and 3 deletions

View File

@@ -85,6 +85,21 @@ class DashboardService:
)
raise
async def get_tts_statistics(self) -> dict[str, Any]:
"""Get comprehensive TTS statistics."""
try:
stats = await self.sound_repository.get_soundboard_statistics("TTS")
return {
"sound_count": stats["count"],
"total_play_count": stats["total_plays"],
"total_duration": stats["total_duration"],
"total_size": stats["total_size"],
}
except Exception:
logger.exception("Failed to get TTS statistics")
raise
def _get_date_filter(self, period: str) -> datetime | None: # noqa: PLR0911
"""Calculate the date filter based on the period."""
now = datetime.now(UTC)