Use literal string interpolation in integrations R-S (f-strings) (#26392)
This commit is contained in:
committed by
Pascal Vizeli
parent
7203027cbf
commit
445c741b30
@@ -217,9 +217,7 @@ async def async_handle_record_service(hass, call):
|
||||
|
||||
# Check for file access
|
||||
if not hass.config.is_allowed_path(video_path):
|
||||
raise HomeAssistantError(
|
||||
"Can't write {}, no access to path!".format(video_path)
|
||||
)
|
||||
raise HomeAssistantError(f"Can't write {video_path}, no access to path!")
|
||||
|
||||
# Check for active stream
|
||||
streams = hass.data[DOMAIN][ATTR_STREAMS]
|
||||
@@ -231,9 +229,7 @@ async def async_handle_record_service(hass, call):
|
||||
# Add recorder
|
||||
recorder = stream.outputs.get("recorder")
|
||||
if recorder:
|
||||
raise HomeAssistantError(
|
||||
"Stream already recording to {}!".format(recorder.video_path)
|
||||
)
|
||||
raise HomeAssistantError(f"Stream already recording to {recorder.video_path}!")
|
||||
|
||||
recorder = stream.add_provider("recorder")
|
||||
recorder.video_path = video_path
|
||||
|
||||
@@ -64,10 +64,7 @@ class M3U8Renderer:
|
||||
@staticmethod
|
||||
def render_preamble(track):
|
||||
"""Render preamble."""
|
||||
return [
|
||||
"#EXT-X-VERSION:3",
|
||||
"#EXT-X-TARGETDURATION:{}".format(track.target_duration),
|
||||
]
|
||||
return ["#EXT-X-VERSION:3", f"#EXT-X-TARGETDURATION:{track.target_duration}"]
|
||||
|
||||
@staticmethod
|
||||
def render_playlist(track, start_time):
|
||||
@@ -84,7 +81,7 @@ class M3U8Renderer:
|
||||
playlist.extend(
|
||||
[
|
||||
"#EXTINF:{:.04f},".format(float(segment.duration)),
|
||||
"./segment/{}.ts".format(segment.sequence),
|
||||
f"./segment/{segment.sequence}.ts",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user