Example #1
0
def one_game(game):
    # Get game dict and print
    gamedict = {}
    gamedict["game"] = {}
    gamedict["players"] = {}

    #  game = nflgame.one(year,week,str(home),str(away))
    if (game.playing() or game.game_over()):
        FillGameInfo(game, gamedict)
        InitTeamPlayers(gamedict)
        StatsFromGame(game, gamedict)
        StatsFromPlayers(game.players, gamedict)
        StatsFromPlays(game.drives.plays(), gamedict)

        if not os.path.exists(output_dir):
            os.makedirs(output_dir)

        outfile = output_dir + "/" + gamedict["game"]["ID"]
        text = print_game(gamedict)
        with open(outfile, "w") as f:
            f.write(text)

    else:
        print "Game is in pregame, starting soon."
Example #2
0
def one_game(game):
    # Get game dict and print
    gamedict = {}
    gamedict["game"] = {}
    gamedict["players"] = {}

    #  game = nflgame.one(year,week,str(home),str(away))
    if (game.playing() or game.game_over()):
        FillGameInfo(game, gamedict)
        InitTeamPlayers(gamedict)
        StatsFromGame(game, gamedict)
        StatsFromPlayers(game.players, gamedict)
        StatsFromPlays(game.drives.plays(), gamedict)

        if not os.path.exists(output_dir):
            os.makedirs(output_dir)

        outfile = output_dir+"/"+gamedict["game"]["ID"]
        text = print_game(gamedict)
        with open(outfile, "w") as f:
            f.write(text)

    else:
        print "Game is in pregame, starting soon."
Example #3
0
def logerror(text):
    f = open("gamestats_error.log", "a")
    f.write(str(datetime.datetime.now()) + " - " + text + "\n")
    f.close()
Example #4
0
def logerror(text):
  f = open("gamestats_error.log", "a")
  f.write(str(datetime.datetime.now())+" - "+text+"\n")
  f.close()