Пример #1
0
async def main():
    setup_environment()
    setup_logger()

    cli_parser = argparse.ArgumentParser(prog='main')
    cli_parser.add_argument('-s', '--settings', help='pass settings as JSON string and start vojp')
    cli_parser.add_argument('-g', '--get', help='returns default vojp settings', action='store_true')

    args = cli_parser.parse_args()
    vojp_settings = ElectronGuiSettings()

    if args.get:
        print(ElectronGuiSettings().to_json())
    sys.stdout.flush()

    if args.settings:
        vojp_settings.read_from_electron(args.settings)
        logging.info(msg='settings received: ' + args.settings)
        print('settings received: ' + args.settings + '\n starting vojp')
        sys.stdout.flush()
    else:
        test_settings = json.dumps(
                {'ip_address'       : '127.0.0.1', 'port': '5000', 'packet_length': '10', 'buffer_size': '10',
                 'host_server'      : 'true', 'echo_mode': 'true', 'record': 'false', 'debug_level': 'DEBUG',
                 'input_sample_rate': '48000', 'output_sample_rate': '48000', 'input_device': '0',
                 'output_device'    : '1'})
        vojp_settings.read_from_electron(test_settings)
    vojp_settings.save_config_ini()

    # start event loop
    await start_vojp(vojp_settings)

    while True:
        await asyncio.sleep(1)
Пример #2
0
def getpoints(vpath):
    import config
    dcfg = argparse.Namespace(
        **{
            'binary': False,
            'file': vpath,
            'outputfile': vpath,
            'skip': True,
            'verbose': 0
        })
    config = config.setup_environment(dcfg)
    parser = gpmf.Parser(config)
    data = parser.readFromMP4()
    points = gopro2gpx.BuildGPSPoints(data, skip=True)
    return points
Пример #3
0
def main():
    args = parseArgs()
    config = setup_environment(args)
    parser = gpmf.Parser(config)

    if not args.binary:
        data = parser.readFromMP4()
    else:
        data = parser.readFromBinary()

    # build some funky tracks from camera GPS

    params = {
        'prev_window': int(args.speed_dir_window),
        'SPEED_skip_en': bool(int(args.speed_skip_en)),
        'ACCL_skip_en': bool(int(args.accl_skip_en)),
        'GPSP_thr': int(args.gpsp_thr),
        'ACCL_thr': int(args.accl_thr),
        'SPEED_thr': int(args.speed_thr),
        'skip': args.skip,
        'quiet': args.quiet
    }

    points, start_time = BuildGPSPoints(data, params)

    if len(points) == 0:
        print("Can't create file. No GPS info in %s. Exiting" % args.file)
        sys.exit(0)

    heel = heel_calc(points, 1.)
    for p, h in zip(points, heel):
        p.heel = h

    kml = gpshelper.generate_KML(points)
    with open("%s.kml" % args.outputfile, "w+") as fd:
        fd.write(kml)

    gpx = gpshelper.generate_GPX(points, start_time, trk_name="gopro7-track")
    with open("%s.gpx" % args.outputfile, "w+") as fd:
        fd.write(gpx)
Пример #4
0
                        action="store_true",
                        default=False)
    parser.add_argument("file", help="Video file or binary metadata dump")
    parser.add_argument("outputfile",
                        nargs="?",
                        help="output file. builds KML and GPX",
                        default="")
    args = parser.parse_args()

    return args


if __name__ == "__main__":

    args = parseArgs()
    config = config.setup_environment(args)
    parser = gpmf.Parser(config)
    """
    If outputfile name unset. set as inputfile name.
    """
    if (args.outputfile is ""):
        args.outputfile = args.file
        print("GPS file save as " + args.outputfile)

    if not args.binary:
        data = parser.readFromMP4()
    else:
        data = parser.readFromBinary()

    # build some funky tracks from camera GPS