feat: Add TTS statistics endpoint and service method for comprehensive TTS data
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user