Example #1
0
def main(opts):
    asyncio_misc_init()

    logging_init(verbose=True)
    osd_logsaver = MemoryLoggingHandler(install=True, max_records=30)
    # Debug messages do not go to OSD, only to console and file.
    osd_logsaver.setLevel(logging.INFO)

    json_logsaver = MemoryLoggingHandler(install=True, max_records=1000)

    root = logging.getLogger()

    if opts.log_dir is None:
        for pdir in LOG_DIR_LOCATIONS:
            opts.log_dir = os.path.abspath(os.path.expanduser(pdir))
            if os.path.exists(opts.log_dir):
                break
        logging.info('Auto-detected logdir as %r', opts.log_dir)

    if opts.check:
        logging.info('Check passed')
        return

    if opts.log_dir != '' and opts.log_prefix is None:
        opts.log_prefix = os.path.abspath(
            os.path.join(
                opts.log_dir,
                time.strftime('mjlog-%Y%m%d-%H%M%S', time.localtime())))

    if opts.log_prefix:
        print 'Saving logs to %s.*' % opts.log_prefix
        txtname = opts.log_prefix + '.log'
        try:
            os.makedirs(os.path.dirname(txtname))
        except OSError:
            pass

        txtlog = logging.FileHandler(txtname, encoding='utf-8')
        txtlog.setFormatter(
            logging.Formatter(
                "%(asctime)s.%(msecs).3d [%(levelname).1s] %(name)s: %(message)s",
                datefmt="%F %T"))
        txtlog.setLevel(logging.DEBUG)
        root.addHandler(txtlog)

    video_window_init()

    ci_kwargs = dict(osd_logsaver=osd_logsaver,
                     json_logsaver=json_logsaver,
                     test_sim_keys=opts.test_sim_keys)
    if opts.addr is None:
        ann = UdpAnnounceReceiver(opts, ci_kwargs=ci_kwargs)
    else:
        cif = ControlInterface(opts, opts.addr, **ci_kwargs)

    logging.info('Running')
    video_window_main()
Example #2
0
def main(opts):
    asyncio_misc_init()

    logging_init(verbose=True)
    osd_logsaver = MemoryLoggingHandler(install=True, max_records=30)
    # Debug messages do not go to OSD, only to console and file.
    osd_logsaver.setLevel(logging.INFO)

    json_logsaver = MemoryLoggingHandler(install=True, max_records=1000)

    root = logging.getLogger()

    if opts.log_dir is None:
        for pdir in LOG_DIR_LOCATIONS:
            opts.log_dir = os.path.abspath(os.path.expanduser(pdir))
            if os.path.exists(opts.log_dir):
                break
        logging.info('Auto-detected logdir as %r', opts.log_dir)

    if opts.check:
        logging.info('Check passed')
        return

    if opts.log_dir != '' and opts.log_prefix is None:
        opts.log_prefix = os.path.abspath(os.path.join(
            opts.log_dir,
            time.strftime('mjlog-%Y%m%d-%H%M%S', time.localtime())))

    if opts.log_prefix:
        print 'Saving logs to %s.*' % opts.log_prefix
        txtname = opts.log_prefix + '.log'
        try:
            os.makedirs(os.path.dirname(txtname))
        except OSError:
            pass

        txtlog = logging.FileHandler(txtname, encoding='utf-8')
        txtlog.setFormatter(logging.Formatter(
            "%(asctime)s.%(msecs).3d [%(levelname).1s] %(name)s: %(message)s",
            datefmt="%F %T"))
        txtlog.setLevel(logging.DEBUG)
        root.addHandler(txtlog)


    video_window_init()

    ci_kwargs = dict(osd_logsaver=osd_logsaver,
                     json_logsaver=json_logsaver,
                     test_sim_keys=opts.test_sim_keys)
    if opts.addr is None:
        ann = UdpAnnounceReceiver(opts, ci_kwargs=ci_kwargs)
    else:
        cif = ControlInterface(opts, opts.addr, **ci_kwargs)

    logging.info('Running')
    video_window_main()
Example #3
0
def main(opts):
    vui_helpers.asyncio_misc_init()

    vui_helpers.logging_init(verbose=True)

    logsaver = vui_helpers.MemoryLoggingHandler(install=True)

    if opts.check:
        logging.info('Check passed')
        return
    # cleanup hack
    proc = subprocess.Popen(
        "killall -v gst-launch-1.0",
        shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT);
    outmsg, _ = proc.communicate()
    for line in outmsg.split('\n'):
        line = line.strip()
        if line != '': logging.debug('Cleanup says: ' + line)
    logging.debug('Cleanup complete, result %r' % proc.returncode)

    cif = ControlInterface(opts, logsaver=logsaver)
    logging.debug('Running')

    asyncio.get_event_loop().run_forever()