if __name__ == '__main__': """ - example: ./gen_web.py -b ~/work/darpa/data/finaltest01/out/ -G ~/work/darpa/data/finaltest01/LOCATION-LOG.2010-03-04@16:05:35.789.log -E ~/work/darpa/data/finaltest01/GPSTEST-TAGFILE.2010-03-04@16:10:32.784.log -q ~/tmp/images.sqlite3 """ # gather command line options parser = common.get_opts() opts, args = get_more_opts(parser) # re-order list of cams for web display cams = common.list_cams(common.CAMS) # order frames and put in a "frame table" ftable = common.create_frametable(opts.base, cams, opts.start_file, opts.image_count) # get default gps and events files fevents = opts.event if opts.event else\ os.path.join(opts.base, "GPSTEST-TAGFILE.log") fgps = opts.gps if opts.gps else\ os.path.join(opts.base, "LOCATION-LOG.log") # parse gps and tag files for use tagged_hash = taggedhash(ftable, gpsevents(fevents, True)) gps_hash = gpshash(ftable, gpsevents(fgps)) gps_hash.update(tagged_hash) # create and load db w/ frame table and gps info create_db(opts.sql, len(cams)) load_db(opts.sql, ftable, gps_hash) # run the website and launch firefox if we are asked to do that if (opts.run): thread = threading.Thread(target=lambda: os.system("firefox http://localhost:8020")) thread.start() run_web.run_web(opts.base, opts.sql)
if __name__ == '__main__': if len(sys.argv) == 3 and sys.argv[1] == "composite": cams = composite.order_for_composite(common.CAMS) ftable = common.create_frametable(BASE_DIR, cams) common.create_dir(sys.argv[2]) composite.write_images(ftable, sys.argv[2], "960x720", len(cams), FONT_FILE) elif len(sys.argv) == 2 and sys.argv[1] == "avgsizes": cams = common.list_cams(common.CAMS) ftable = common.create_frametable(BASE_DIR, cams) totsize = 0 count = 0 for frame in ftable: for fi in frame: totsize += os.path.getsize(fi.filename()) count += 1 print ((totsize / count) / 1024.00) else: cams = common.list_cams(common.CAMS) ftable = common.create_frametable(BASE_DIR, cams) taggedevents = gen_web.gpsevents(EVENT_FILE, True) tagged_hash = gen_web.taggedhash(ftable, taggedevents) gps_hash = gen_web.gpshash(ftable, gen_web.gpsevents(GPS_FILE)) gps_hash.update(tagged_hash) gen_web.create_db(SQL_FILE, len(cams)) gen_web.load_db(SQL_FILE, ftable, gps_hash) thread = threading.Thread(target=lambda: os.system("firefox http://localhost:8020")) thread.start() run_web.run_web(BASE_DIR, SQL_FILE)
""" - example: ./gen_web.py -b ~/work/darpa/data/finaltest01/out/ -G ~/work/darpa/data/finaltest01/LOCATION-LOG.2010-03-04@16:05:35.789.log -E ~/work/darpa/data/finaltest01/GPSTEST-TAGFILE.2010-03-04@16:10:32.784.log -q ~/tmp/images.sqlite3 """ # gather command line options parser = common.get_opts() opts, args = get_more_opts(parser) # re-order list of cams for web display cams = common.list_cams(common.CAMS) # order frames and put in a "frame table" ftable = common.create_frametable(opts.base, cams, opts.start_file, opts.image_count) # get default gps and events files fevents = opts.event if opts.event else\ os.path.join(opts.base, "GPSTEST-TAGFILE.log") fgps = opts.gps if opts.gps else\ os.path.join(opts.base, "LOCATION-LOG.log") # parse gps and tag files for use tagged_hash = taggedhash(ftable, gpsevents(fevents, True)) gps_hash = gpshash(ftable, gpsevents(fgps)) gps_hash.update(tagged_hash) # create and load db w/ frame table and gps info create_db(opts.sql, len(cams)) load_db(opts.sql, ftable, gps_hash) # run the website and launch firefox if we are asked to do that if (opts.run): thread = threading.Thread( target=lambda: os.system("firefox http://localhost:8020")) thread.start() run_web.run_web(opts.base, opts.sql)