Example #1
0
from bbos.config import loggingSetup
loggingSetup.initializeLogging("install.py")
import logging
import shutil 
from bbos.config.bbosConfig import BBOSConfig
from osandio.fileCompression import Unzipper
import os

def main():
    logging.info("Starting bbos install!")
    
    from distutils.sysconfig import get_python_lib
    pythonLibDir = get_python_lib()
    
    copyAndUnzip(getSQLAlchemyLocation(), pythonLibDir, getSQLAlchemyFileName())
    
    copyAndUnzip(getPyMySQLLocation(), pythonLibDir, getPyMySQLFileName())

def getSQLAlchemyFileName():
    return "sqlalchemy.7z"

def getSQLAlchemyLocation():
    return ".." + os.sep + "tools" + os.sep + "sqlAlchemy" + os.sep + getSQLAlchemyFileName()

def getPyMySQLFileName():
    return "pymysql.7z"

def getPyMySQLLocation():
    return ".." + os.sep + "tools" + os.sep + "pymysql" + os.sep + getPyMySQLFileName()

def copyAndUnzip(toMove, destinationDir, zipFileName):
Example #2
0
from bbos.config import loggingSetup
loggingSetup.initializeLogging("deleteBBOSGame.py")
import logging
from bbos.gameday.www.directoryStructure import GamedayDirectoryStructure
from bbos.gameday.options import commandLineOptionsParser
from bbos.config.bbosConfig import BBOSConfig
from bbos.gameday.loader.gameLoader import GamedayGameLoader
from bbos.gameday.www.gameXMLProvider import GamedayXMLProvider
from bbos.gameday.loader.gameStatsWorkList import GameStatsWorkList
from bbos.db.db import DB
      
       
def main():
    
    options = commandLineOptionsParser.parseOptions()
    
    logging.info("Starting delete!")
        
    league = options.league
        
    try:
        gamedayDirectory = GamedayDirectoryStructure(BBOSConfig.gamedayURL, league)
        
        if options.game:
            gamedayGameURLs = gamedayDirectory.getGameURLsForGame(options.game)    
        elif options.day:
            gamedayGameURLs = gamedayDirectory.getGameURLsForDay(eval(options.day))    
        elif options.year:
            gamedayGameURLs = gamedayDirectory.getGameURLsForYear(options.year)
        elif options.recent:
            gamedayGameURLs = gamedayDirectory.getGameURLsForLastNumberOfDays(BBOSConfig.gamedayDaysBackToLoad)
Example #3
0
import os
import subprocess
import threading
import Queue
import glob
from osandio.fileCompression import Unzipper
from bbos.config.bbosConfig import BBOSConfig
import tempfile
import re
import time
import sqlalchemy
import csv
import logging
from bbos.config import loggingSetup
from bbos.retrosheet.options import commandLineOptionsParser
loggingSetup.initializeLogging("bbosRetrosheet.py")
    
logging.info("Starting bbosRetrosheet!")

THREADS = 20
RETROSHEET_URL = BBOSConfig.retrosheetURL
CHADWICK = os.path.abspath(BBOSConfig.pathToChadwick)
ENGINE = BBOSConfig.sqlAlchemyEngine
HOST = BBOSConfig.sqlAlchemyHost
DATABASE = BBOSConfig.sqlAlchemyDatabase   
USER = None if not BBOSConfig.sqlAlchemyUser else BBOSConfig.sqlAlchemyUser
SCHEMA = None if not BBOSConfig.sqlAlchemySchema else BBOSConfig.sqlAlchemySchema
PASSWORD = None if not BBOSConfig.sqlAlchemyPassword else BBOSConfig.sqlAlchemyPassword

if USER and PASSWORD: string = '%s://%s:%[email protected]%s/%s' % (ENGINE, USER, PASSWORD, HOST, DATABASE)
else:  string = '%s://%s/%s' % (ENGINE, HOST, DATABASE)
Example #4
0
from bbos.config import loggingSetup
loggingSetup.initializeLogging("bbos.py")
import logging

from threadit import threadIt

from bbos.gameday.www.directoryStructure import GamedayDirectoryStructure
from bbos.config.bbosConfig import BBOSConfig
from bbos.gameday.www.gameXMLProvider import GamedayXMLProvider
from bbos.gameday.loader.gameLoader import GamedayGameLoader
from bbos.gameday.loader.gameStatsWorkList import GameStatsWorkList
from bbos.db.db import DB
from bbos.gameday.options import commandLineOptionsParser

        
def main():
    options = commandLineOptionsParser.parseOptions()
    
    logging.info("Starting bbos!")
    
    league = options.league
    
    try:
        gamedayDirectory = GamedayDirectoryStructure(BBOSConfig.gamedayURL, league)
        
        if options.game:
            gamedayGameURLs = gamedayDirectory.getGameURLsForGame(options.game)    
        elif options.day:
            gamedayGameURLs = gamedayDirectory.getGameURLsForDay(eval(options.day))    
        elif options.year:
            gamedayGameURLs = gamedayDirectory.getGameURLsForYear(options.year)
Example #5
0
from bbos.config import loggingSetup
loggingSetup.initializeLogging("bbosPlayerBio.py")
import logging

from threadit import threadIt

from bbos.gameday.www.directoryStructure import GamedayDirectoryStructure
from bbos.config.bbosConfig import BBOSConfig
from bbos.gameday.loader.gameLoader import GamedayGameLoader
from bbos.gameday.www.gameXMLProvider import GamedayXMLProvider
from bbos.gameday.loader.playerBioWorkList import PlayerBioWorkList
from bbos.db.db import DB
from bbos.gameday.options import commandLineOptionsParser

        
def main():
    options = commandLineOptionsParser.parseOptions()
    
    logging.info("Starting bbosPlayerBio!")
    
    league = options.league
    
    try:
        gamedayDirectory = GamedayDirectoryStructure(BBOSConfig.gamedayURL, league)
        
        if options.game:
            gamedayGameURLs = gamedayDirectory.getGameURLsForGame(options.game)    
        elif options.day:
            gamedayGameURLs = gamedayDirectory.getGameURLsForDay(eval(options.day))    
        elif options.all != None:
            gamedayGameURLs = gamedayDirectory.getGameURLsForAllAvailable()
Example #6
0
from bbos.db.db import DB
from bbos.config import loggingSetup
loggingSetup.initializeLogging("createBBOS.py")
import logging

    
def createMLB(db):
    sqlFile = "..\\sql\\createGamedaySchema.sql"
    
    db.run(sqlFile)
    
def create():
    db = DB()
    
    createMLB(db)
    
def main():
    create()    
    

if __name__ == '__main__':
    try:
        main()
    except Exception, e:
        logging.info(e.message)
        raise Exception(e)
    
from bbos.db.db import DB
from bbos.config import loggingSetup
loggingSetup.initializeLogging("normalizeBBOS.py")
import logging
    
def runNormalizeSQL(db):
    sqlFile = "..\\sql\\normalizeGamedayToMLB.sql"
    
    db.run(sqlFile)
    
def runUserDefinedSQL(db):
    sqlFile = "..\\sql\\user.sql"
    
    db.run(sqlFile)
    
def create():
    db = DB()
    
    runNormalizeSQL(db)
    runUserDefinedSQL(db)
    
    
def main():
    create()    
    
if __name__ == '__main__':
    try:
        main()
    except Exception, e:
        logging.info(e.message)
        raise Exception(e)
from bbos.db.db import DB
from bbos.config import loggingSetup
loggingSetup.initializeLogging("createRetrosheet.py")
import logging

    
def createMLB(db):
    sqlFile = "..\\sql\\retrosheet.sql"
    
    db.run(sqlFile)
    
def create():
    db = DB()
    
    createMLB(db)
    
def main():
    create()    
    

if __name__ == '__main__':
    try:
        main()
    except Exception, e:
        logging.info(e.message)
        raise Exception(e)
    
Example #9
0
import unittest
from bbos.config import loggingSetup
loggingSetup.initializeLogging('bbosFTest.py')

class FTest(unittest.TestCase):
    pass