if o in ("-d", "--debug"): DEBUG = True elif o in ("-r", "--run"): if a == 'live': STREAM_SERVER = '216.18.184.22:1935' STREAM_USER = '******' PIC_PATH = '/srv/LIVE_model_imgs_ramfs/' ONLINE_MODELS_URL = 'http://www.seeme.com/onlinemodels' PID_FILE = '/tmp/LIVE_ffmpeg_websocket_server.pid' PORT = 8023 FLASH_PORT = 10843 else: assert False, "unhandled option" q = Queue() q.maxsize = 1000 fd = inotify.init() inotify.add_watch(fd, PIC_PATH, inotify.IN_CREATE) stream_dumper = StreamDumper() gevent.spawn(event_producer, fd, q) signal.signal(signal.SIGTERM, exit_cleanup) signal.signal(signal.SIGINT, exit_cleanup) signal.signal(signal.SIGQUIT, exit_cleanup) atexit.register(exit_cleanup) if DEBUG: print("writing pid file: %s" % PID_FILE) with open(PID_FILE, 'w') as f: f.write(str(os.getpid())) # start ffmpeg processes for online models