Created
August 24, 2014 02:07
-
-
Save SnacksOnAPlane/41cf8165cb4bbb2dadb0 to your computer and use it in GitHub Desktop.
brawl go.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
smiley@smiley-laptop:~/code/brawl-scrape$ cat go.py | |
#!/usr/bin/python | |
import nflgame | |
import ipdb | |
import time | |
CURRENT_YEAR = 2014 | |
CURRENT_WEEK = 4 | |
CURRENT_KIND = 'PRE' | |
ACTIVE_GAME = '2014082300' | |
def getActiveGames(): | |
return nflgame.live.current_games(kind=CURRENT_KIND) | |
return games | |
def displayGames(games): | |
for game in games: | |
print game.home, game.away | |
def currentDrive(game): | |
current_drive_id = sorted(game.data['drives'].keys())[-2] | |
current_drive = game.data['drives'][str(current_drive_id)] | |
return current_drive | |
def listPlays(drive): | |
for playID in sorted(drive['plays'].keys()): | |
print playID, drive['plays'][playID]['desc'] | |
while True: | |
for game in getActiveGames(): | |
print "\n\nGame:", game.nice_score() | |
drive = currentDrive(game) | |
print "\nCurrent Drive:", drive['start'] | |
listPlays(drive) | |
time.sleep(15) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment