diff --git a/start.py b/start.py index a5ce600..e3f3a6e 100755 --- a/start.py +++ b/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'])