示例#1
0
def FillGameInfo(game, gamedict):
  gamedict["game"]["homescore"] = game.score_home
  gamedict["game"]["awayscore"] = game.score_away
  gamedict["game"]["date"] = game.schedule
  year = str(game.schedule["eid"])[0:4]
  gamedict["game"]["ID"] = year+str(game.schedule["month"]).strip().zfill(2)+str(game.schedule["day"]).strip().zfill(2)+"_"+game.away+"@"+game.home
  gamedict["game"]["away"] = game.away
  gamedict["game"]["home"] = game.home
  gamedict["game"]["season"] = game.season()
  gamedict["game"]["week"] = str(game.schedule["week"]).strip()
  gamedict["game"]["status"] = f.get_key(str(game.time))
示例#2
0
def StatsFromPlayers(players, gamedict):
  for player in players:
    phpffl_id = GetPhpfflID(player.playerid)
    gamedict["players"][phpffl_id] = {}
    gamedict["players"][phpffl_id]["name"] = player.name # For debugging

    for stat in player.stats:
      phpffl_stat = f.get_key(stat)
      if gamedict["players"][phpffl_id].get(phpffl_stat) is None:
        gamedict["players"][phpffl_id][phpffl_stat] = player.stats[stat]
      else:
        gamedict["players"][phpffl_id][phpffl_stat] += player.stats[stat]
示例#3
0
def StatsFromPlayers(players, gamedict):
    for player in players:
        phpffl_id = GetPhpfflID(player.playerid)
        gamedict["players"][phpffl_id] = {}
        gamedict["players"][phpffl_id]["name"] = player.name  # For debugging

        for stat in player.stats:
            phpffl_stat = f.get_key(stat)
            if gamedict["players"][phpffl_id].get(phpffl_stat) is None:
                gamedict["players"][phpffl_id][phpffl_stat] = player.stats[
                    stat]
            else:
                gamedict["players"][phpffl_id][phpffl_stat] += player.stats[
                    stat]
示例#4
0
def FillGameInfo(game, gamedict):
    gamedict["game"]["homescore"] = game.score_home
    gamedict["game"]["awayscore"] = game.score_away
    gamedict["game"]["date"] = game.schedule
    year = str(game.schedule["eid"])[0:4]
    gamedict["game"]["ID"] = year + str(
        game.schedule["month"]).strip().zfill(2) + str(
            game.schedule["day"]).strip().zfill(
                2) + "_" + game.away + "@" + game.home
    gamedict["game"]["away"] = game.away
    gamedict["game"]["home"] = game.home
    gamedict["game"]["season"] = game.season()
    gamedict["game"]["week"] = str(game.schedule["week"]).strip()
    gamedict["game"]["status"] = f.get_key(str(game.time))
示例#5
0
def StatsFromPlays(plays, gamedict):
    for play in plays:
        for event in play.events:
            for stat in event:
                phpffl_stat = f.get_key(stat)
                # Stats for team players
                if stat == "passing_sk":  # Switched to passing_sk_yds to catch "Team Sacks"
                    f.team_sack(event, gamedict)
                # if stat == "defense_sk":
                #  f.team_sack(event,gamedict)
                if stat == "fumbles_lost":
                    f.team_fumble(event, gamedict)
                if stat == "defense_int":
                    f.team_defint(event, gamedict)
                if stat == "defense_tds":
                    f.team_def_td(event, gamedict)
                if stat == "defense_safe":
                    f.team_def_saf(event, gamedict)
                if stat == "puntret_tds" or stat == "kickret_tds":
                    f.team_st_td(event, gamedict)
                # scenario where def recovers fumble, fumbles again and gets a TD
                if stat == "fumbles_rec_tds" and event["team"] != play.team:
                    f.team_def_td(event, gamedict)

                # Stats for human players
                if stat == "kicking_fgm_yds":  # Need yardages for each field goal
                    phpffl_id = GetPhpfflID(event["playerid"])
                    if gamedict["players"].get(
                            phpffl_id) is None:  # new player, initialize
                        gamedict["players"][phpffl_id] = {}
                        #gamedict["players"][phpffl_id]["name"] = player.name # For debugging
                    f.player_field_goal(phpffl_id, event, gamedict)
                if (stat == "kickret_yds"
                        or stat == "puntret_yds") and play.note != "FUMBLE":
                    phpffl_id = GetPhpfflID(event["playerid"])
                    f.AddPlayerStat(phpffl_id, stat, event, gamedict)
                if (stat == "kicking_fgmissed"):
                    phpffl_id = GetPhpfflID(event["playerid"])
                    f.AddPlayerStat(phpffl_id, stat, event, gamedict)
                if (stat == "rushing_tds") or (stat == "receiving_tds"):
                    phpffl_id = GetPhpfflID(event["playerid"])
                    f.AddPlayerTD(phpffl_id, stat, event, gamedict)
示例#6
0
def StatsFromPlays(plays, gamedict):
  for play in plays:
    for event in play.events:
      for stat in event:
        phpffl_stat = f.get_key(stat)
        # Stats for team players
        if stat == "passing_sk": # Switched to passing_sk_yds to catch "Team Sacks"
          f.team_sack(event,gamedict)
        # if stat == "defense_sk":
        #  f.team_sack(event,gamedict)
        if stat == "fumbles_lost":
          f.team_fumble(event,gamedict)
        if stat == "defense_int":
          f.team_defint(event,gamedict)
        if stat == "defense_tds":
          f.team_def_td(event,gamedict)
        if stat == "defense_safe":
          f.team_def_saf(event,gamedict)
        if stat == "puntret_tds" or stat == "kickret_tds":
          f.team_st_td(event,gamedict)
        # scenario where def recovers fumble, fumbles again and gets a TD
        if stat == "fumbles_rec_tds" and event["team"] != play.team:
          f.team_def_td(event,gamedict)

        # Stats for human players
        if stat == "kicking_fgm_yds": # Need yardages for each field goal
          phpffl_id = GetPhpfflID(event["playerid"])
          if gamedict["players"].get(phpffl_id) is None:  # new player, initialize
            gamedict["players"][phpffl_id] = {}
            #gamedict["players"][phpffl_id]["name"] = player.name # For debugging
          f.player_field_goal(phpffl_id, event, gamedict)
        if (stat == "kickret_yds" or stat == "puntret_yds") and play.note != "FUMBLE":
          phpffl_id = GetPhpfflID(event["playerid"])
          f.AddPlayerStat(phpffl_id, stat, event, gamedict)
        if (stat == "kicking_fgmissed"):
          phpffl_id = GetPhpfflID(event["playerid"])
          f.AddPlayerStat(phpffl_id, stat, event, gamedict)
        if (stat == "rushing_tds") or (stat == "receiving_tds"):
          phpffl_id = GetPhpfflID(event["playerid"])
          f.AddPlayerTD(phpffl_id, stat, event, gamedict)