drop mjpeg streamer
This commit is contained in:
parent
df5d019877
commit
998f9a6ad8
26
start.py
26
start.py
|
@ -5,37 +5,11 @@ import time
|
|||
import os
|
||||
import pwd
|
||||
|
||||
MJPG = [
|
||||
"/usr/local/bin/mjpg_streamer",
|
||||
"-i",
|
||||
"%(input)s",
|
||||
"-o",
|
||||
"output_http.so -p %(port)s -w /usr/local/share/mjpg-streamer/www/",
|
||||
]
|
||||
|
||||
MJPG_INPUT_DEFAULT = "input_uvc.so -r HD"
|
||||
|
||||
OCTOPRINT = ["/opt/octoprint/venv/bin/octoprint", "serve"]
|
||||
|
||||
|
||||
def main():
|
||||
mjpg_processes = []
|
||||
mjpg_ports = [5000] # Reserve the OctoPrint port
|
||||
for k, v in os.environ.iteritems():
|
||||
if k.startswith("MJPG") and not k.startswith("MJPG_"):
|
||||
v = v.strip()
|
||||
port_env = "MJPG_PORT" + k[4:]
|
||||
port = int(os.environ.get(port_env, 8080))
|
||||
if port in mjpg_ports:
|
||||
raise ValueError("Port %s from key %s already in use" % (port, port_env))
|
||||
if not v:
|
||||
v = MJPG_INPUT_DEFAULT
|
||||
subs = {'input': v, 'port': port}
|
||||
cmd = []
|
||||
for part in MJPG:
|
||||
cmd.append(part % subs)
|
||||
print("Starting: %s" % (cmd,))
|
||||
mjpg_processes.append(subprocess.Popen(cmd))
|
||||
|
||||
# Start klipper
|
||||
klipper = subprocess.Popen(['sudo', '-u', 'octoprint', '/runklipper.py'])
|
||||
|
|
Loading…
Reference in New Issue