#!/usr/bin/python 

import sqlite3

from StatsClass import NcaaGrabber

stats = NcaaGrabber()

#teams  = stats.getTeams('fcs', 2008)

# teams.update(stats.getTeams('fbs', 2008))

# for team in teams:
# 	print("[%s], [%s]" % (team, teams[team]))

numWeeks = stats.getNumWeeks('fbs', 2011)
print("Num weeks: " + str(numWeeks))

for week in range(1,numWeeks+1):

    isHome = stats.isHomeGame(8, 2011, week)

    print(isHome)

# myStats = stats.getStats(8, 2011, 1)

# print(myStats)
# print("\n")

#sched = stats.processWeekly('fbs', 2008, 1, teams)
#print(sched)
    cursor.execute(statsCreateStr)

if ( len(sys.argv) < 2 ):
    print("Usage: currentSeason.py <db> <year> <week>")
    exit(-1)

dbPath = sys.argv[1]

conn = sqlite3.connect(dbPath)
cursor = conn.cursor()

if ( not checkTables(cursor) ):
    buildTables(cursor)
    conn.commit()

statsGrabber = NcaaGrabber()

#years = range(2008,2012)
years = [2012]
for year in years:

    teams = statsGrabber.getTeams('fcs', year)
    teams.update(statsGrabber.getTeams('fbs', year))

    # Insert the teams
    for team in teams:
        insertTeam(cursor, year, teams[team], team)
        conn.commit()

    divisions = ['fcs', 'fbs']