def get_rider_list(): mkresults.dbh = sqlite3.connect('race_database.sql3') conf = mkresults.config(args.config) mkresults.conf = conf mkresults.args = namedtuple('Args', 'no_cat debug')(no_cat=False, debug=args.verbose) startTime = conf.start_ms / 1000 retrievalTime = startTime + conf.start_window_ms / 1000 sleepTime = retrievalTime - time.time() while sleepTime > 0: print "Sleeping %s seconds" % sleepTime time.sleep(sleepTime) sleepTime = retrievalTime - time.time() conf.load_chalklines() R, all_pos = mkresults.get_riders(conf.start_ms - conf.lookback_ms, conf.finish_ms) return [ r.id for r in R.values() if mkresults.filter_start(r) ]
for opt,val in opts: if opt == '--verbose': g_verbose = True elif opt == '--dont-check-certificates': g_verifyCert = False startTime = conf.start_ms/1000 retrievalTime = startTime + 600 #10 minute window hardcoded for now sleepTime = retrievalTime - time.time() while sleepTime > 0: print "Sleeping %s seconds" % sleepTime time.sleep(sleepTime) sleepTime = retrievalTime - time.time() conf.load_chalklines() R = mkresults.get_riders(conf.start_ms - mkresults.min2ms(2.0), conf.finish_ms) START_WINDOW = 10.0 F = [ r for r in R.values() if mkresults.filter_start(r, START_WINDOW) ] if g_verbose: print 'Selected %d riders' % len(R) session = requests.session() access_token = login(session, user, password) for u in F: updateRider(session, access_token, u.id) dbh.commit() dbh.close() if __name__ == '__main__': try: