Skip to content

Commit

Permalink
Add go2rtc binary validation #509
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Oct 6, 2024
1 parent 6ec491a commit c4c0fa9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions custom_components/webrtc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ def validate_binary(hass: HomeAssistant) -> Optional[str]:
filename += ".exe"

filename = hass.config.path(filename)
if os.path.isfile(filename) and os.access(filename, os.X_OK):
return filename
try:
if os.path.isfile(filename) and subprocess.check_output(
[filename, "-v"]
).startswith(b"go2rtc"):
return filename
except:
pass

# remove all old binaries
for file in os.listdir(hass.config.config_dir):
Expand Down

0 comments on commit c4c0fa9

Please sign in to comment.