Initial commit: полный проект my_speaker
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# app/core/status.py
|
||||
from enum import Enum
|
||||
import logging
|
||||
from threading import Lock
|
||||
|
||||
logger = logging.getLogger('VADApp')
|
||||
|
||||
class SystemStatus(Enum):
|
||||
INITIALIZATION = "Инициализация"
|
||||
LISTENING = "Прослушивание"
|
||||
RECORDING = "Запись"
|
||||
RECOGNITION = "Распознавание"
|
||||
COMMAND_PROCESSING = "Обработка команды"
|
||||
RESPONSE = "Ответ"
|
||||
|
||||
class StatusTracker:
|
||||
def __init__(self):
|
||||
self.current_status = SystemStatus.INITIALIZATION
|
||||
self.lock = Lock()
|
||||
|
||||
def set_status(self, status: SystemStatus):
|
||||
with self.lock:
|
||||
self.current_status = status
|
||||
logger.info(f"Статус: {status.value}")
|
||||
|
||||
def get_status(self) -> str:
|
||||
with self.lock:
|
||||
return self.current_status.value
|
||||
|
||||
# Global instance (or can be stored in app.state)
|
||||
status_tracker = StatusTracker()
|
||||
Reference in New Issue
Block a user