original_docstring: Generate an HTTP MJPEG stream from the camera.
docstring: Generate an HTTP MJPEG stream from the camera.
docstring_tokens: Generate an HTTP MJPEG stream from the camera .
code: async def handle_async_mjpeg_stream(self, request):
          """Generate an HTTP MJPEG stream from the camera."""
          video = await self.hass.async_add_executor_job(
              getattr, self._camera, "last_video"
          )
  
          if not video:
              error_msg = (
                  f"Video not found for {self._name}. "
                  f"Is it older than {self._camera.min_days_vdo_cache} days?"
              )
              _LOGGER.error(error_msg)
              return
  
          stream = CameraMjpeg(self._ffmpeg.binary)
          await stream.open_camera(video.video_url, extra_cmd=self._ffmpeg_arguments)
  
          try:
              stream_reader = await stream.get_reader()
              return await async_aiohttp_proxy_stream(
                  self.hass,
                  request,
                  stream_reader,
                  self._ffmpeg.ffmpeg_stream_content_type,
              )
          finally:
              try:
                  await stream.close()
              except:
                  _LOGGER.debug(f"problem with stream close for {self._name}")
code_tokens: async def handle_async_mjpeg_stream ( self , request ) : video = await self . hass . async_add_executor_job ( getattr , self . _camera , "last_video" ) if not video : error_msg = ( f"Video not found for {self._name}. " f"Is it older than {self._camera.min_days_vdo_cache} days?" ) _LOGGER . error ( error_msg ) return stream = CameraMjpeg ( self . _ffmpeg . binary ) await stream . open_camera ( video . video_url , extra_cmd = self . _ffmpeg_arguments ) try : stream_reader = await stream . get_reader ( ) return await async_aiohttp_proxy_stream ( self . hass , request , stream_reader , self . _ffmpeg . ffmpeg_stream_content_type , ) finally : try : await stream . close ( ) except : _LOGGER . debug ( f"problem with stream close for {self._name}" )
short_docstring: Generate an HTTP MJPEG stream from the camera.
short_docstring_tokens: Generate an HTTP MJPEG stream from the camera .
comment: """Generate an HTTP MJPEG stream from the camera."""