custom_components/webrtc/utils.py
This commit is contained in:
@@ -233,9 +233,10 @@ async def websocket_forward(ws_from, ws_to) -> None:
|
|||||||
|
|
||||||
|
|
||||||
class Server(Thread):
|
class Server(Thread):
|
||||||
def __init__(self, binary: str):
|
def __init__(self, binary: str, config_dir: str = ""):
|
||||||
super().__init__(name=DOMAIN, daemon=True)
|
super().__init__(name=DOMAIN, daemon=True)
|
||||||
self.binary = binary
|
self.binary = binary
|
||||||
|
self.config_dir = config_dir
|
||||||
self.process = None
|
self.process = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -243,9 +244,12 @@ class Server(Thread):
|
|||||||
return self.process.poll() is None if self.process else False
|
return self.process.poll() is None if self.process else False
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
env = None
|
||||||
|
if self.config_dir:
|
||||||
|
env = {**__import__("os").environ, "CONFIG": self.config_dir + "/go2rtc.yaml"}
|
||||||
while self.binary:
|
while self.binary:
|
||||||
self.process = subprocess.Popen(
|
self.process = subprocess.Popen(
|
||||||
[self.binary], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
[self.binary], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env
|
||||||
)
|
)
|
||||||
|
|
||||||
# check alive
|
# check alive
|
||||||
|
|||||||
Reference in New Issue
Block a user