From 374bcf80736bcffcb97f950eff1da94e9c366626 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 27 Feb 2020 11:58:28 +0100 Subject: [PATCH] Adjust sound reload (#1531) * Adjust sound reload & remove quirk * clean info message * fix hack --- supervisor/audio.py | 10 ++++++---- supervisor/core.py | 8 ++++---- supervisor/host/sound.py | 3 +++ supervisor/misc/hardware.py | 1 - 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/supervisor/audio.py b/supervisor/audio.py index 93c6fc6ce..7dab5ffdd 100644 --- a/supervisor/audio.py +++ b/supervisor/audio.py @@ -81,9 +81,7 @@ class Audio(JsonConfig, CoreSysAttributes): # Run PulseAudio with suppress(AudioError): - if await self.instance.is_running(): - await self.restart() - else: + if not await self.instance.is_running(): await self.start() # Initialize Client Template @@ -137,8 +135,12 @@ class Audio(JsonConfig, CoreSysAttributes): async def restart(self) -> None: """Restart Audio plugin.""" - with suppress(DockerAPIError): + _LOGGER.info("Restart Audio plugin") + try: await self.instance.restart() + except DockerAPIError: + _LOGGER.error("Can't start Audio plugin") + raise AudioError() from None async def start(self) -> None: """Run CoreDNS.""" diff --git a/supervisor/core.py b/supervisor/core.py index 3881635e0..bc7f62371 100644 --- a/supervisor/core.py +++ b/supervisor/core.py @@ -145,13 +145,13 @@ class Core(CoreSysAttributes): # Start observe the host Hardware await self.sys_hwmonitor.load() + # Upate Host/Deivce information + self.sys_create_task(self.sys_host.reload()) + self.sys_create_task(self.sys_updater.reload()) + _LOGGER.info("Supervisor is up and running") self.state = CoreStates.RUNNING - # On full host boot, relaod information - self.sys_create_task(self.sys_host.reload()) - self.sys_create_task(self.sys_updater.reload()) - async def stop(self): """Stop a running orchestration.""" # don't process scheduler anymore diff --git a/supervisor/host/sound.py b/supervisor/host/sound.py index 5d97ce3df..7138594ce 100644 --- a/supervisor/host/sound.py +++ b/supervisor/host/sound.py @@ -116,6 +116,9 @@ class SoundControl(CoreSysAttributes): # Update input self._input.clear() for source in pulse.source_list(): + # Filter monitor devices out because we did not use it now + if source.name.endswith(".monitor"): + continue self._input.append( AudioProfile( source.name, diff --git a/supervisor/misc/hardware.py b/supervisor/misc/hardware.py index 7d6919c6d..c75e8b3ad 100644 --- a/supervisor/misc/hardware.py +++ b/supervisor/misc/hardware.py @@ -133,7 +133,6 @@ class Hardware: def audio_devices(self) -> Dict[str, Any]: """Return all available audio interfaces.""" if not ASOUND_CARDS.exists(): - _LOGGER.info("No audio devices found") return {} try: