mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Use f-strings in go2rtc code and test and do not use abbreviation (#130158)
This commit is contained in:
parent
1ac9217630
commit
c97cc34879
@ -244,21 +244,21 @@ class WebRTCProvider(CameraWebRTCProvider):
|
|||||||
|
|
||||||
if self._data.managed:
|
if self._data.managed:
|
||||||
# HA manages the go2rtc instance
|
# HA manages the go2rtc instance
|
||||||
stream_org_name = camera.entity_id + "_orginal"
|
stream_original_name = f"{camera.entity_id}_orginal"
|
||||||
stream_redirect_sources = [
|
stream_redirect_sources = [
|
||||||
f"rtsp://127.0.0.1:{HA_MANAGED_RTSP_PORT}/{stream_org_name}",
|
f"rtsp://127.0.0.1:{HA_MANAGED_RTSP_PORT}/{stream_original_name}",
|
||||||
f"ffmpeg:{stream_org_name}#audio=opus",
|
f"ffmpeg:{stream_original_name}#audio=opus",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(stream_org := streams.get(stream_org_name)) is None
|
(stream_org := streams.get(stream_original_name)) is None
|
||||||
or not any(
|
or not any(
|
||||||
stream_source == producer.url for producer in stream_org.producers
|
stream_source == producer.url for producer in stream_org.producers
|
||||||
)
|
)
|
||||||
or (stream_redirect := streams.get(camera.entity_id)) is None
|
or (stream_redirect := streams.get(camera.entity_id)) is None
|
||||||
or stream_redirect_sources != [p.url for p in stream_redirect.producers]
|
or stream_redirect_sources != [p.url for p in stream_redirect.producers]
|
||||||
):
|
):
|
||||||
await self._rest_client.streams.add(stream_org_name, stream_source)
|
await self._rest_client.streams.add(stream_original_name, stream_source)
|
||||||
await self._rest_client.streams.add(
|
await self._rest_client.streams.add(
|
||||||
camera.entity_id, stream_redirect_sources
|
camera.entity_id, stream_redirect_sources
|
||||||
)
|
)
|
||||||
|
@ -313,7 +313,7 @@ async def test_setup_managed(
|
|||||||
camera = init_test_integration
|
camera = init_test_integration
|
||||||
|
|
||||||
entity_id = camera.entity_id
|
entity_id = camera.entity_id
|
||||||
stream_name_orginal = camera.entity_id + "_orginal"
|
stream_name_orginal = f"{camera.entity_id}_orginal"
|
||||||
assert camera.frontend_stream_type == StreamType.HLS
|
assert camera.frontend_stream_type == StreamType.HLS
|
||||||
|
|
||||||
assert await async_setup_component(hass, DOMAIN, config)
|
assert await async_setup_component(hass, DOMAIN, config)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user