Prevent using pulseaudio on event loop (#1536)

* Prevent using pulseaudio on event loop

* Fix name overwrite

* Fix value
This commit is contained in:
Pascal Vizeli
2020-02-27 22:01:20 +01:00
committed by GitHub
parent 8a6ea7ab50
commit 19ca836b78
2 changed files with 122 additions and 103 deletions

View File

@@ -29,7 +29,7 @@ from ..const import (
)
from ..coresys import CoreSysAttributes
from ..exceptions import APIError
from ..host.sound import SourceType
from ..host.sound import StreamType
from .utils import api_process, api_process_raw, api_validate
_LOGGER: logging.Logger = logging.getLogger(__name__)
@@ -115,7 +115,7 @@ class APIAudio(CoreSysAttributes):
@api_process
async def set_volume(self, request: web.Request) -> None:
"""Set audio volume on stream."""
source: SourceType = SourceType(request.match_info.get("source"))
source: StreamType = StreamType(request.match_info.get("source"))
body = await api_validate(SCHEMA_VOLUME, request)
await asyncio.shield(
@@ -125,7 +125,7 @@ class APIAudio(CoreSysAttributes):
@api_process
async def set_default(self, request: web.Request) -> None:
"""Set audio default stream."""
source: SourceType = SourceType(request.match_info.get("source"))
source: StreamType = StreamType(request.match_info.get("source"))
body = await api_validate(SCHEMA_DEFAULT, request)
await asyncio.shield(self.sys_host.sound.set_default(source, body[ATTR_NAME]))