Adjust sound reload (#1531)

* Adjust sound reload & remove quirk

* clean info message

* fix hack
This commit is contained in:
Pascal Vizeli 2020-02-27 11:58:28 +01:00 committed by GitHub
parent 7e3859e2f5
commit 374bcf8073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 9 deletions

View File

@ -81,9 +81,7 @@ class Audio(JsonConfig, CoreSysAttributes):
# Run PulseAudio # Run PulseAudio
with suppress(AudioError): with suppress(AudioError):
if await self.instance.is_running(): if not await self.instance.is_running():
await self.restart()
else:
await self.start() await self.start()
# Initialize Client Template # Initialize Client Template
@ -137,8 +135,12 @@ class Audio(JsonConfig, CoreSysAttributes):
async def restart(self) -> None: async def restart(self) -> None:
"""Restart Audio plugin.""" """Restart Audio plugin."""
with suppress(DockerAPIError): _LOGGER.info("Restart Audio plugin")
try:
await self.instance.restart() await self.instance.restart()
except DockerAPIError:
_LOGGER.error("Can't start Audio plugin")
raise AudioError() from None
async def start(self) -> None: async def start(self) -> None:
"""Run CoreDNS.""" """Run CoreDNS."""

View File

@ -145,13 +145,13 @@ class Core(CoreSysAttributes):
# Start observe the host Hardware # Start observe the host Hardware
await self.sys_hwmonitor.load() await self.sys_hwmonitor.load()
_LOGGER.info("Supervisor is up and running") # Upate Host/Deivce information
self.state = CoreStates.RUNNING
# On full host boot, relaod information
self.sys_create_task(self.sys_host.reload()) self.sys_create_task(self.sys_host.reload())
self.sys_create_task(self.sys_updater.reload()) self.sys_create_task(self.sys_updater.reload())
_LOGGER.info("Supervisor is up and running")
self.state = CoreStates.RUNNING
async def stop(self): async def stop(self):
"""Stop a running orchestration.""" """Stop a running orchestration."""
# don't process scheduler anymore # don't process scheduler anymore

View File

@ -116,6 +116,9 @@ class SoundControl(CoreSysAttributes):
# Update input # Update input
self._input.clear() self._input.clear()
for source in pulse.source_list(): 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( self._input.append(
AudioProfile( AudioProfile(
source.name, source.name,

View File

@ -133,7 +133,6 @@ class Hardware:
def audio_devices(self) -> Dict[str, Any]: def audio_devices(self) -> Dict[str, Any]:
"""Return all available audio interfaces.""" """Return all available audio interfaces."""
if not ASOUND_CARDS.exists(): if not ASOUND_CARDS.exists():
_LOGGER.info("No audio devices found")
return {} return {}
try: try: