Move recorder.py import to runtime (#52682)

This commit is contained in:
uvjustin
2021-07-08 00:20:27 -07:00
committed by Franck Nijhof
parent 2038fb04b1
commit 286c068f6f

View File

@@ -43,7 +43,6 @@ from .const import (
) )
from .core import PROVIDERS, IdleTimer, StreamOutput from .core import PROVIDERS, IdleTimer, StreamOutput
from .hls import async_setup_hls from .hls import async_setup_hls
from .recorder import RecorderOutput
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@@ -265,6 +264,10 @@ class Stream:
) -> None: ) -> None:
"""Make a .mp4 recording from a provided stream.""" """Make a .mp4 recording from a provided stream."""
# Keep import here so that we can import stream integration without installing reqs
# pylint: disable=import-outside-toplevel
from .recorder import RecorderOutput
# Check for file access # Check for file access
if not self.hass.config.is_allowed_path(video_path): if not self.hass.config.is_allowed_path(video_path):
raise HomeAssistantError(f"Can't write {video_path}, no access to path!") raise HomeAssistantError(f"Can't write {video_path}, no access to path!")