def main(): # configure logging docolor = (Args.color == 'always') or (Args.color == 'auto' and sys.stderr.isatty()) handler = LogHandler(docolor, Args.timestamp) logging.root.addHandler(handler) if Args.verbose >= 2: level = logging.DEBUG elif Args.verbose == 1: level = logging.INFO else: level = logging.WARNING logging.root.setLevel(level) # make killable by ctrl-c logging.debug('setting SIGINT handler') signal.signal(signal.SIGINT, signal.SIG_DFL) logging.info('Python Version: %s', sys.version_info) logging.info('GStreamer Version: %s', Gst.version()) # init main-class and main-loop logging.debug('initializing Voctocore') voctocore = Voctocore() logging.debug('running Voctocore') voctocore.run()
def main(): # parse command-line args args = lib.args.parse() docolor = (args.color == 'always') \ or (args.color == 'auto' and sys.stderr.isatty()) handler = LogHandler(docolor, args.timestamp) logging.root.handlers = [handler] if args.verbose >= 2: level = logging.DEBUG elif args.verbose == 1: level = logging.INFO else: level = logging.WARNING logging.root.setLevel(level) # make killable by ctrl-c logging.debug('setting SIGINT handler') signal.signal(signal.SIGINT, signal.SIG_DFL) logging.info('Python Version: %s', sys.version_info) logging.info('GStreamer Version: %s', Gst.version()) logging.debug('loading Config') config = lib.config.load(args) # init main-class and main-loop logging.debug('initializing AES67-Backup') backup_tool = Backuptool(config) logging.debug('running AES67-Backup') backup_tool.run()
def main(): # parse command-line args from lib import args args.parse() from lib.args import Args docolor = (Args.color == 'always') or (Args.color == 'auto' and sys.stderr.isatty()) handler = LogHandler(docolor, Args.timestamp) logging.root.addHandler(handler) if Args.verbose >= 2: level = logging.DEBUG elif Args.verbose == 1: level = logging.INFO else: level = logging.WARNING logging.root.setLevel(level) # make killable by ctrl-c logging.debug('setting SIGINT handler') signal.signal(signal.SIGINT, signal.SIG_DFL) logging.info('Python Version: %s', sys.version_info) logging.info('GStreamer Version: %s', Gst.version()) # init main-class and main-loop logging.debug('initializing DecklinkToTcp') main = DecklinkToTcp() logging.debug('running DecklinkToTcp') main.run()
def main(): global conf, macMapping, hostAddress, t, ready, ncdict, pipeline # configure logging docolor = (Args.color == 'always') or (Args.color == 'auto' and sys.stderr.isatty()) handler = LogHandler(docolor) logging.root.addHandler(handler) if Args.verbose >= 2: level = logging.DEBUG elif Args.verbose == 1: level = logging.INFO else: level = logging.WARNING level = logging.DEBUG logging.root.setLevel(level) #load config conf = loadconfig("config.json") macMapping = conf["macMapping"] hostAddress = conf["hostAddress"] #start server t = threading.Thread(target=run_server) t.start() if clearOnStart: try: shutil.rmtree("./config") except FileNotFoundError: pass while not ready: try: time.sleep(2) print("\x1b[2J\x1b[H") monitorManager.load() print('syncstream ready') print('- registered clients -') for mon in monitorManager.monitors: print('{}: {} ({})'.format(mon.index, mon.ip, mon.mac)) print('press ctrl+c to start') except KeyboardInterrupt: print('Starting!') # make killable by ctrl-c logging.debug('setting SIGINT handler') signal.signal(signal.SIGINT, signal.SIG_DFL) # init main-class and main-loop logging.debug('Creating Pipeline') pipeline = Pipeline() source = TCPSource(9999) netclock = NetClock(pipeline, None, 10000) pipeline.configure() pipeline.start() netclock.start() ncdict = netclock.netprov ready = True logging.info('running GObject MainLoop') MainLoop.run()
def main(): # configure logging docolor = (Args.color == 'always') or (Args.color == 'auto' and sys.stderr.isatty()) handler = LogHandler(docolor, Args.timestamp) logging.root.addHandler(handler) if Args.verbose >= 2: level = logging.DEBUG elif Args.verbose == 1: level = logging.INFO else: level = logging.WARNING logging.root.setLevel(level) # make killable by ctrl-c logging.debug('setting SIGINT handler') signal.signal(signal.SIGINT, signal.SIG_DFL) logging.info('Python Version: %s', sys.version_info) logging.info('GStreamer Version: %s', Gst.version()) # establish a synchronus connection to server Connection.establish(Config.get('server', 'host')) # fetch config from server Config.fetchServerConfig() # Warn when connecting to a non-local core without preview-encoders enabled # the list-comparison is not complete (one could use a local hostname or the local system ip) # but it's only here to warn that one might be making a mistake use_previews = Config.getboolean( 'previews', 'enabled') and Config.getboolean('previews', 'use') looks_like_localhost = Config.get( 'server', 'host') in ['::1', '127.0.0.1', 'localhost'] if not use_previews and not looks_like_localhost: logging.warn( 'Connecting to `%s` (which looks like a remote host) might not work without enabeling ' 'the preview encoders (set `[previews] enabled=true` on the core) or it might saturate ' 'your ethernet link between the two machines.', Config.get('server', 'host')) # obtain network-clock ClockManager.obtainClock(Connection.ip) # switch connection to nonblocking, event-driven mode Connection.enterNonblockingMode() # init main-class and main-loop # (this binds all event-hander on the Connection) logging.debug('initializing Voctogui') voctogui = Voctogui() # start the Mainloop and show the Window logging.debug('running Voctogui') voctogui.run()
def main(): # configure logging docolor = sys.stderr.isatty() handler = LogHandler(docolor) logging.root.addHandler(handler) level = logging.DEBUG logging.root.setLevel(level) # init main-class and main-loop logging.debug('initializing NetRecv') n = NetRevc(host=sys.argv[2], monitor_id=int(sys.argv[1]), raspi=raspi, base_time=int(sys.argv[3])) n.run()
def main(): # configure logging docolor = (Args.color == 'always') or (Args.color == 'auto' and sys.stderr.isatty()) handler = LogHandler(docolor) logging.root.addHandler(handler) if Args.verbose >= 2: level = logging.DEBUG elif Args.verbose == 1: level = logging.INFO else: level = logging.WARNING logging.root.setLevel(level) # make killable by ctrl-c logging.debug('setting SIGINT handler') signal.signal(signal.SIGINT, signal.SIG_DFL) logging.info('Python Version: %s', sys.version_info) logging.info('GStreamer Version: %s', Gst.version()) # establish a synchronus connection to server Connection.establish( Config.get('server', 'host')) # fetch config from server Config.fetchServerConfig() # switch connection to nonblocking, event-driven mode Connection.enterNonblockingMode() # init main-class and main-loop # (this binds all event-hander on the Connection) logging.debug('initializing Voctogui') voctogui = Voctogui() # start the Mainloop and show the Window logging.debug('running Voctogui') voctogui.run()
def main(): # configure logging docolor = sys.stderr.isatty() handler = LogHandler(docolor) logging.root.addHandler(handler) level = logging.DEBUG logging.root.setLevel(level) parser = argparse.ArgumentParser() parser.add_argument("path", type=str, help="Path to video files") parser.add_argument("random", type=bool, action="store_true", help="randomly select a file. Default: true") parser.add_argument("loop", type=bool, action="store_true", help="run in a loop. Default: true") args = parser.parse_args() runloop = args["loop"] while runloop: dir = os.path.normpath(args["path"]) files = os.scandir(path=dir) filenum = 0 if args["random"]: filenum = random.randint(0, len(files)) else: if filenum + 1 < len(files): filenum += 1 else: filenum = 0 file = files[filenum] pipelineTemplate = """"filesrc location={path} ! decodebin ! video/x-raw ! videorate ! videoscale ! video/x-raw, format=I420, width=1920, height=1080, framerate=25/1 ! matroskamux ! tcpclientsink port={port} host={host}""" pipeline = Gst.parse_launch( pipelineTemplate.format(path=file.path, host='127.0.0.1', port='9999')) pipeline.set_state(Gst.State.PLAYING)
def main(): # configure logging docolor = sys.stderr.isatty() handler = LogHandler(docolor) logging.root.addHandler(handler) level = logging.DEBUG logging.root.setLevel(level) # make killable by ctrl-c logging.debug('setting SIGINT handler') signal.signal(signal.SIGINT, signal.SIG_DFL) logging.info('Python Version: %s', sys.version_info) logging.info('GStreamer Version: %s', Gst.version()) # init main-class and main-loop logging.debug('initializing NetRecv') netrecv = NetRevc('127.0.0.1', 2) logging.debug('running SyncStream') netrecv.run()
def main(): docolor = (Args.color == 'always') or (Args.color == 'auto' and sys.stderr.isatty()) loghandler = LogHandler(docolor, Args.timestamp) logging.root.addHandler(loghandler) if Args.verbose >= 2: level = logging.DEBUG elif Args.verbose == 1: level = logging.INFO else: level = logging.WARNING logging.root.setLevel(level) logging.debug('setting SIGINT handler') signal.signal(signal.SIGINT, signal.SIG_DFL) Connection.establish(Args.host) Connection.enterNonblockingMode() Connection.on("message", testCallback) mainloop = GObject.MainLoop() mainloop.run() while True: logging.debug("mimimi...") Connection.send("message", "test2") time.sleep(10)