示例#1
0
def getRaces(folder, season, week, verbose):

    fileName = "%s/Season %d Week %d.txt" % (folder, season, week)
    if os.path.exists(fileName):
        print "%s already exists, exiting" % fileName
        exit(1)
        
    logging.config.fileConfig(iRacingUtils.getConfigFileName())
    
    username, password = iRacingUtils.getAccountDetails()
    primaryDAL = iRacingDAL.iRacingDAL(username, password)
    
    cache = MemoryCache.MemoryCache()
    dal = cachingDAL.cachingDAL(primaryDAL, cache)
    
    if not verbose: logging.getLogger().setLevel(logging.ERROR)
    races = dal.getSeasonRaces(season, week)
    logging.getLogger().info("Processing %d races for season %d week %d" % (len(races), season, week))
    i = 0
    for race in races:
        i += 1
        logging.getLogger().info("(%d,%d) race %d of %d" % (season, week, i, len(races)) )
        if race.isofficial:
            race.setResults(dal.getRaceResults(race.subsessionid))
            for result in race.getResults().itervalues():
                if result.laps == None:
                    result.setLaps(dal.getLaps(race.subsessionid, result.custid))
   
    if len(cache.races) == 0:
        logging.getLogger().info("No races were downloaded. No file written.")
        exit(0)
        
    iRacingUtils.writeCacheToPickle(cache, fileName)
示例#2
0
def main():

    masterCache = MemoryCache.MemoryCache()
    try:
        os.path.walk("racecache/", doFile, masterCache)
    except Exception as e:
        print e
        exit(1)

    iRacingUtils.writeCacheToPickle(masterCache, "racecache/Allraces.txt")
示例#3
0
def main():
        
    masterCache = MemoryCache.MemoryCache()
    try:
        os.path.walk("racecache/", doFile, masterCache)
    except Exception as e:
        print e
        exit(1)
        
    iRacingUtils.writeCacheToPickle(masterCache, "racecache/Allraces.txt")
示例#4
0
def getRaces(folder, season, week, verbose):

    fileName = "%s/Season %d Week %d.txt" % (folder, season, week)
    if os.path.exists(fileName):
        print "%s already exists, exiting" % fileName
        exit(1)

    logging.config.fileConfig(iRacingUtils.getConfigFileName())

    username, password = iRacingUtils.getAccountDetails()
    primaryDAL = iRacingDAL.iRacingDAL(username, password)

    cache = MemoryCache.MemoryCache()
    dal = cachingDAL.cachingDAL(primaryDAL, cache)

    if not verbose: logging.getLogger().setLevel(logging.ERROR)
    races = dal.getSeasonRaces(season, week)
    logging.getLogger().info("Processing %d races for season %d week %d" %
                             (len(races), season, week))
    i = 0
    for race in races:
        i += 1
        logging.getLogger().info("(%d,%d) race %d of %d" %
                                 (season, week, i, len(races)))
        if race.isofficial:
            race.setResults(dal.getRaceResults(race.subsessionid))
            for result in race.getResults().itervalues():
                if result.laps == None:
                    result.setLaps(
                        dal.getLaps(race.subsessionid, result.custid))

    if len(cache.races) == 0:
        logging.getLogger().info("No races were downloaded. No file written.")
        exit(0)

    iRacingUtils.writeCacheToPickle(cache, fileName)