diff options
author | Devaev Maxim <[email protected]> | 2018-06-27 23:33:45 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-06-28 00:01:13 +0300 |
commit | 1a419cc52d2fa2cfcc9f1a842fc001137948d306 (patch) | |
tree | 93f55be59c1f3705af6562fecd53d2cc89b7151c | |
parent | 3fefb0d5191228081abd636ad9d0059bbae00c61 (diff) |
removed streamer events
-rw-r--r-- | kvmd/kvmd/__init__.py | 6 | ||||
-rw-r--r-- | kvmd/kvmd/streamer.py | 9 |
2 files changed, 0 insertions, 15 deletions
diff --git a/kvmd/kvmd/__init__.py b/kvmd/kvmd/__init__.py index e259654c..8fda37da 100644 --- a/kvmd/kvmd/__init__.py +++ b/kvmd/kvmd/__init__.py @@ -75,7 +75,6 @@ class _Application: self.__system_tasks.extend([ self.__loop.create_task(self.__poll_dead_sockets()), self.__loop.create_task(self.__poll_atx_leds()), - self.__loop.create_task(self.__poll_streamer_events()), ]) aiohttp.web.run_app( @@ -134,11 +133,6 @@ class _Application: await self.__broadcast("EVENT atx_leds %d %d" % (self.__atx.get_leds())) await asyncio.sleep(self.__config["atx"]["leds"]["poll"]) - @_system_task - async def __poll_streamer_events(self) -> None: - async for event in self.__streamer.events(): - await self.__broadcast("EVENT %s" % (event)) - async def __broadcast(self, msg: str) -> None: await asyncio.gather(*[ ws.send_str(msg) diff --git a/kvmd/kvmd/streamer.py b/kvmd/kvmd/streamer.py index ab6e717e..c6533069 100644 --- a/kvmd/kvmd/streamer.py +++ b/kvmd/kvmd/streamer.py @@ -2,7 +2,6 @@ import asyncio import asyncio.subprocess from typing import Dict -from typing import AsyncIterator from typing import Optional from contextlog import get_logger @@ -34,7 +33,6 @@ class Streamer: # pylint: disable=too-many-instance-attributes self.__loop = loop self.__lock = asyncio.Lock() - self.__events_queue: asyncio.Queue = asyncio.Queue() self.__proc_task: Optional[asyncio.Task] = None def __set_output_pin(self, pin: int) -> int: @@ -42,10 +40,6 @@ class Streamer: # pylint: disable=too-many-instance-attributes GPIO.output(pin, False) return pin - async def events(self) -> AsyncIterator[str]: - while True: - yield (await self.__events_queue.get()) - async def start(self) -> None: async with self.__lock: get_logger().info("Starting mjpg_streamer ...") @@ -61,7 +55,6 @@ class Streamer: # pylint: disable=too-many-instance-attributes await asyncio.gather(self.__proc_task, return_exceptions=True) await self.__set_hw_enabled(False) self.__proc_task = None - await self.__events_queue.put("mjpg_streamer stopped") async def __set_hw_enabled(self, enabled: bool) -> None: # This sequence is important for enable @@ -82,9 +75,7 @@ class Streamer: # pylint: disable=too-many-instance-attributes stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.STDOUT, ) - logger.info("Started mjpg_streamer pid=%d: %s", proc.pid, self.__cmd) - await self.__events_queue.put("mjpg_streamer started") empty = 0 while proc.returncode is None: |