Skip to content

Commit

Permalink
Merge pull request #378 from cwendt94/fb_game_date
Browse files Browse the repository at this point in the history
Football Box Player Game Date
  • Loading branch information
cwendt94 authored Oct 5, 2022
2 parents 6c60546 + 6d929bc commit 47db6fb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion espn_api/football/box_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from .player import Player
from datetime import datetime, timedelta


class BoxPlayer(Player):
'''player with extra data from a matchup'''
def __init__(self, data, pro_schedule, positional_rankings, week, year):
Expand All @@ -17,7 +18,8 @@ def __init__(self, data, pro_schedule, positional_rankings, week, year):
player = data['playerPoolEntry']['player'] if 'playerPoolEntry' in data else data['player']
if player['proTeamId'] in pro_schedule:
(opp_id, date) = pro_schedule[player['proTeamId']]
self.game_played = 100 if datetime.now() > datetime.fromtimestamp(date/1000.0) + timedelta(hours=3) else 0
self.game_date = datetime.fromtimestamp(date/1000.0)
self.game_played = 100 if datetime.now() > self.game_date + timedelta(hours=3) else 0
posId = str(player['defaultPositionId'])
if posId in positional_rankings:
self.pro_opponent = PRO_TEAM_MAP[opp_id]
Expand Down

0 comments on commit 47db6fb

Please sign in to comment.