Beispiel #1
0
def init_for_cvfile(args, capture):
    if not capture.is_active():
        IkaUtils.dprint('Failed to initialize with: %s' % capture._source_file)
        sys.exit(1)

    pos_msec = args.get('time_msec') or time_to_msec(args.get('time') or '0:0')
    if pos_msec:
        capture.set_pos_msec(pos_msec)


if __name__ == "__main__":
    signal.signal(signal.SIGINT, signal_handler)

    args = get_args()
    capture, OutputPlugins = config_loader.config(args)

    if isinstance(capture, inputs.CVFile):
        init_for_cvfile(args, capture)

    engine = IkaEngine(enable_profile=args.get('profile'))
    engine.pause(False)
    engine.set_capture(capture)

    epoch_time = get_epoch_time(args, capture)
    if epoch_time:
        engine.set_epoch_time(epoch_time)

    engine.set_plugins(OutputPlugins)
    engine.close_session_at_eof = True
    engine.run()
Beispiel #2
0
def init_for_cvfile(args, capture):
    if not capture.is_active():
        IkaUtils.dprint('Failed to initialize with: %s' % capture._source_file)
        sys.exit(1)

    pos_msec = args.get('time_msec') or time_to_msec(args.get('time') or '0:0')
    if pos_msec:
        capture.set_pos_msec(pos_msec)


if __name__ == "__main__":
    signal.signal(signal.SIGINT, signal_handler)

    args = get_args()
    capture, output_plugins = config_loader.config(args)

    if isinstance(capture, inputs.CVFile):
        init_for_cvfile(args, capture)

    engine = IkaEngine(enable_profile=args.get('profile'))
    engine.pause(False)
    engine.set_capture(capture)

    epoch_time = get_epoch_time(args, capture)
    if epoch_time:
        engine.set_epoch_time(epoch_time)

    engine.set_plugins(output_plugins)
    for op in output_plugins:
        engine.enable_plugin(op)
Beispiel #3
0

def get_pos_msec(args):
    if args['time_msec']:
        return args['time_msec']
    elif args['time']:
        minute, sec = args['time'].split(':')
        return (int(minute) * 60 + int(sec)) * 1000
    else:
        return 0


if __name__ == "__main__":
    signal.signal(signal.SIGINT, signal_handler)

    args = get_args()
    capture, output_plugins = config_loader.config(args)
    capture.set_pos_msec(get_pos_msec(args))

    engine = IkaEngine(enable_profile=args.get('profile'))
    engine.pause(False)
    engine.set_capture(capture)

    engine.set_plugins(output_plugins)
    for op in output_plugins:
        engine.enable_plugin(op)

    engine.close_session_at_eof = True
    engine.run()
    IkaUtils.dprint('bye!')