Exemple #1
0
    def testCalculation(self):
        from db.footballdb import FootballPlayerDB

        r = FootballRules()
        fdb = FootballPlayerDB()
        fdb.wget()
        fp = fdb.player["cam newton - car"]
        print str(fp)
        print "Passing Points 2016: " + str(r.passingPoints(fp,2016))
        print "Passing Points 2015: " + str(r.passingPoints(fp,2015))
        print "Passing Points 2014: " + str(r.passingPoints(fp,2014))
Exemple #2
0
class OLeagueFootballLeague(FootballLeague):
    def __init__(self):
        from cli.cmd.command import SearchByPositionCommand

        name = "O-League"
        rules = OLeagueFootballRules()
        db = FootballPlayerDB(name)
        super(OLeagueFootballLeague, self).__init__(name, db, rules)
        self.property['isAuctionDraft'] = 'true'
        db.load()

        self.parser.commands.append(SearchByPositionCommand('all'))
        self.parser.commands.append(SearchByPositionCommand('qb'))
        self.parser.commands.append(SearchByPositionCommand('wr'))
        self.parser.commands.append(SearchByPositionCommand('te'))
        self.parser.commands.append(SearchByPositionCommand('rb'))

        self.parser.commands.append(StatsCommand())

        self.parser.autosave = True


    def factoryReset(self):

        from sitescraper.nfl.footballdbdotcom import FootballDBDotComScraper
        from sitescraper.multisport.rotoworlddotcom import RotoWorldDotComScraper

        self.db = FootballPlayerDB(self.name)
        self.db.wget(scrapers=[FootballDBDotComScraper()])

        rotoScrape = RotoWorldDotComScraper(league="nfl")
        for p in self.db.player:
            if 'DEF' in self.db.player[p].position:
                continue
            #print "RotoWorld: Learning about " + self.db.player[p].name + "..."
            pStats = rotoScrape.scrape(playerName=self.db.player[p].name)
            if pStats is not None:
                self.db.player[p].update(pStats)