update
This commit is contained in:
parent
3f4c49ccf2
commit
cf3e53f8ba
@ -71,18 +71,18 @@ class MediaSourceController(ABC):
|
||||
|
||||
class BluetoothController(MediaSourceController):
|
||||
"""Контроллер для Bluetooth аудио."""
|
||||
|
||||
|
||||
def __init__(self, bt_service: Any):
|
||||
self._bt_service = bt_service
|
||||
self._music_mac: str | None = None
|
||||
|
||||
|
||||
def set_music_mac(self, mac: str | None) -> None:
|
||||
"""Установить приоритетный MAC для музыки."""
|
||||
self._music_mac = mac
|
||||
# Синхронизируем с сервисом
|
||||
if self._bt_service:
|
||||
self._bt_service.set_music_mac(mac)
|
||||
|
||||
|
||||
def get_music_mac(self) -> str | None:
|
||||
"""Получить приоритетный MAC для музыки."""
|
||||
return self._music_mac
|
||||
@ -199,7 +199,7 @@ class MediaController(QObject):
|
||||
self._settings = QSettings("car_ui", "ui")
|
||||
self._controllers: dict[str, MediaSourceController] = {}
|
||||
self._current_mode: str = "bluetooth"
|
||||
|
||||
|
||||
# Регистрируем контроллеры
|
||||
self._register_controllers()
|
||||
|
||||
@ -221,7 +221,7 @@ class MediaController(QObject):
|
||||
# Если переключаемся с Bluetooth на CarPlay - ставим паузу
|
||||
if self._current_mode == "bluetooth" and mode == "carplay":
|
||||
self._controllers["bluetooth"].pause()
|
||||
|
||||
|
||||
# Если переключаемся на Bluetooth - подключаем приоритетное устройство
|
||||
elif mode == "bluetooth":
|
||||
bt_controller = self._controllers["bluetooth"]
|
||||
@ -229,7 +229,8 @@ class MediaController(QObject):
|
||||
if music_mac:
|
||||
# Пытаемся подключить приоритетное устройство
|
||||
bt_controller.connect_device(music_mac)
|
||||
|
||||
self._controllers["bluetooth"].play()
|
||||
|
||||
self._current_mode = mode
|
||||
# Сигнал о смене режима для обновления UI
|
||||
self.metadata_changed.emit(self.get_metadata())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user