-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome to the scala-gameday-api wiki!
Assumes a basic knowledge of MySQL (database creation, permissions, etc.).
- Install MySQL (http://www.mysql.com/)
- Create a database named scala_gameday_api
- Create a database user named gameday with full permissions to the scala_gameday_api database
- cd into the scala-gameday-api project directory
- Start a console session: mvn scala:console
- Import the importer: import com.xenopsconsulting.gamedayapi.batch._
- For first-time usage, create the pitch table: MySQLDatabaseImporter.createTables()
- Import commands:
- MySQLDatabaseImporter.importPitchesByYearAndTeam(year: Int, team: String)
- MySQLDatabaseImporter.importPitchesByYearsAndTeam(years: List[Int], team: String)
- MySQLDatabaseImporter.importPitchesByYear(year: Int)
Examples:
- MySQLDatabaseImporter.importPitchesByYearAndTeam(2013, "sea")
- MySQLDatabaseImporter.importPitchesByYearsAndTeam(List(2011, 2012, 2013), "sea")
- MySQLDatabaseImporter.importPitchesByYear(2013)
That last command will take some time to finish. Lots of files to grab!
If you don't know the key for the team you would like to import, you can see the available list for the year by doing the following:
import com.xenopsconsulting.gamedayapi._
new ScheduleYear(2013).teams()
The importer will first check to see if you have already fetched the gameday files it needs for each game it imports. If you have previously downloaded the gameday files (by previously importing a game), it won't make another request to the gameday servers. Cached files are stored under the project directory, in a directory named scala-gameday-api-cache.
Things to be aware of (some of these will be addressed with future development of this API):
- The importer is not very smart. If you run it on a season that is in progress, it will cache the gameday files that say that games are not yet completed and not download individual game files. Months later, if you run the importer again and you still have those same files in your cache (namely, the epg files), the API will still think those games aren't finished and won't download and import the games it didn't get on its previous run, even though those games are now finished. To work around this, you can delete the epg files for days that you don't also see other gameday files. If you scroll through the list of cached files, it should be easy to tell where the importer stopped finding completed games. You'll just see epg files only at a certain date.
Add to your resolvers:
resolvers += "Scala Gameday API" at "http://ecopony.github.com/scala-gameday-api/repository/"
Add to your dependencies:
"com.xenopsconsulting" % "scala-gameday-api" % "0.2"
Add to your repositories:
<repository>
<id>com.xenopsconsulting.scala-gameday-api</id>
<name>Scala Gameday API</name>
<url>http://ecopony.github.com/scala-gameday-api/repository/</url>
</repository>
Add to your dependencies:
<dependency>
<groupId>com.xenopsconsulting</groupId>
<artifactId>scala-gameday-api</artifactId>
<version>0.2</version>
</dependency>