Documentation ¶
Index ¶
- func DateToProcessedFileNoSideEffects(date time.Time, rootURL, rootFS, processedFile string) (string, error)
- func DateToURLNoSideEffects(date time.Time, root string) (*url.URL, error)
- func GameToURLsNoSideEffect(game, root string) ([]*url.URL, error)
- func GetDBConnection() (*sql.DB, error)
- func ParseGameEventsXML(path, date string, filePtr *os.File) error
- func ParseGameXML(path, date string, filePtr *os.File) error
- func SaveURLToPath(targetURL *url.URL, targetPath string, client *http.Client) error
- func URLToFSPathNoSideEffects(realURL *url.URL, root string) (string, error)
- func VerifyFSDirectory(fsPath string) error
- type GameEventsXMLAction
- type GameEventsXMLAtBat
- type GameEventsXMLGame
- type GameEventsXMLHalfInning
- type GameEventsXMLInning
- type GameEventsXMLPitch
- type GameXMLGame
- type GameXMLStadium
- type GameXMLTeam
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DateToProcessedFileNoSideEffects ¶
func DateToProcessedFileNoSideEffects(date time.Time, rootURL, rootFS, processedFile string) (string, error)
DateToProcessedFileNoSideEffects will turn a date and a processed file name into a filesystem path
func DateToURLNoSideEffects ¶
DateToURLNoSideEffects will turn a date into a URL, given a rootURL
func GameToURLsNoSideEffect ¶
GameToURLsNoSideEffect will turn a game into a set of URLs, given a rootURL
func GetDBConnection ¶
GetDBConnection provides a common database connection source for all of the tools
func ParseGameEventsXML ¶
ParseGameEventsXML is a method that opens the locally-saved game_events.xml file and parses the
contents into data structures.
func ParseGameXML ¶
ParseGameXML is a method that opens the locally-saved game.xml file and parses the
contents into data structures.
func SaveURLToPath ¶
SaveURLToPath downloads a URL to a specific path on the filesystem
func URLToFSPathNoSideEffects ¶
URLToFSPathNoSideEffects will turn a URL into a filesystem path. If the URL doesn't specify an
actual file name, append index.html to it because that is what the web server is going to do. Also, get rid of some of the intermediate portions of the URL to prevent the filesystem path from being unnecessarily long.
func VerifyFSDirectory ¶
VerifyFSDirectory verifies that a directory exists on the system, and creates it if it doesn't exist.
Types ¶
type GameEventsXMLAction ¶
type GameEventsXMLAction struct { Balls string `xml:"b,attr"` Strikes string `xml:"s,attr"` Outs string `xml:"o,attr"` EnglishDescription string `xml:"des,attr"` EspañolDescription string `xml:"des_es,attr"` EnglishEvent string `xml:"event,attr"` EspañolEvent string `xml:"event_es,attr"` TFS string `xml:"tfs,attr"` TFSZulu string `xml:"tfs_zulu,attr"` Player string `xml:"player,attr"` Pitch string `xml:"pitch,attr"` EventNumber string `xml:"event_num,attr"` HomeTeamRuns string `xml:"home_team_runs,attr"` AwayTeamRuns string `xml:"away_team_runs,attr"` }
GameEventsXMLAction describes the action structure present in the game_events.xml file
type GameEventsXMLAtBat ¶
type GameEventsXMLAtBat struct { BatterNumber string `xml:"num,attr"` Balls string `xml:"b,attr"` Strikes string `xml:"s,attr"` Outs string `xml:"o,attr"` StartTFS string `xml:"start_tfs,attr"` StartTFSZulu string `xml:"start_tfs_zulu,attr"` Batter string `xml:"batter,attr"` Pitcher string `xml:"pitcher,attr"` EnglishDescription string `xml:"des,attr"` EspañolDescription string `xml:"des_es,attr"` EventNumber string `xml:"event_num,attr"` EnglishEvent string `xml:"event,attr"` EspañolEvent string `xml:"event_es,attr"` PlayGUID string `xml:"play_guid,attr"` Score string `xml:"score,attr"` HomeTeamRuns string `xml:"home_team_runs,attr"` AwayTeamRuns string `xml:"away_team_runs,attr"` FirstBasePlayer string `xml:"b1,attr"` SecondBasePlayer string `xml:"b2,attr"` ThirdBasePlayer string `xml:"b3,attr"` Pitches []GameEventsXMLPitch `xml:"pitch"` }
GameEventsXMLAtBat describes the at-bat structure present in the game_events.xml file
type GameEventsXMLGame ¶
type GameEventsXMLGame struct {
Innings []GameEventsXMLInning `xml:"inning"`
}
GameEventsXMLGame describes the game structure present in the game_events.xml file
type GameEventsXMLHalfInning ¶
type GameEventsXMLHalfInning struct { AtBats []GameEventsXMLAtBat `xml:"atbat"` Actions []GameEventsXMLAction `xml:"action"` }
GameEventsXMLHalfInning describes the half-inning structure present in the game_events.xml file
type GameEventsXMLInning ¶
type GameEventsXMLInning struct { Number string `xml:"num,attr"` TopHalf GameEventsXMLHalfInning `xml:"top"` BottomHalf GameEventsXMLHalfInning `xml:"bottom"` }
GameEventsXMLInning describes the inning structure present in the game_events.xml file
type GameEventsXMLPitch ¶
type GameEventsXMLPitch struct { SVID string `xml:"sv_id,attr"` EnglishDescription string `xml:"des,attr"` EspañolDescription string `xml:"des_es,attr"` Type string `xml:"type,attr"` StartSpeed string `xml:"start_speed,attr"` PitchType string `xml:"pitch_type,attr"` }
GameEventsXMLPitch describes the pitch structure present in the game_events.xml file
type GameXMLGame ¶
type GameXMLGame struct { Type string `xml:"type,attr"` LocalGameTime string `xml:"local_game_time,attr"` GamePK string `xml:"game_pk,attr"` GameTimeEastern string `xml:"game_time_et,attr"` GamedaySW string `xml:"gameday_sw,attr"` Teams []GameXMLTeam `xml:"team"` Stadium GameXMLStadium `xml:"stadium"` }
GameXMLGame describes the game structure present in the game.xml file
type GameXMLStadium ¶
type GameXMLStadium struct { ID string `xml:"id,attr"` Name string `xml:"name,attr"` VenueWhoKnows string `xml:"venue_w_chan_loc,attr"` Location string `xml:"location,attr"` }
GameXMLStadium decribes the stadium structure present in the game.xml file
type GameXMLTeam ¶
type GameXMLTeam struct { Type string `xml:"type,attr"` Code string `xml:"code,attr"` FileCode string `xml:"file_code,attr"` Abbreviation string `xml:"abbrev,attr"` ID string `xml:"id,attr"` Name string `xml:"name,attr"` FullName string `xml:"name_full,attr"` BriefName string `xml:"name_brief,attr"` Wins string `xml:"w,attr"` Losses string `xml:"l,attr"` DivisionID string `xml:"division_id,attr"` LeagueID string `xml:"league_id,attr"` League string `xml:"league,attr"` }
GameXMLTeam describes the team structure present in the game.xml file