Baseball Files
gameday_boxscore
GameDay XML - Game Box Score.
http://gd2.mlb.com/components/game/mlb/year_####/month_##/day_##/gid_####_##_##_???mlb_???mlb_1/boxscore.xml
classes:
GameDayBoxScore (GameDayXML)
boxPlayer
boxBattingStats (boxPlayer)
boxBatter (boxPlayer)
boxPitchingStats (boxPlayer)
boxPitcher (boxPlayer)
functions:
dispatch(cmd,args) - Module Command Dispatch
get_boxscore(dt,tc) - Default function
Developer@Sonnack.com
December 2011
function dispatch
Dispatch Command.
commands:
main - Get Boxscore for given date
today - Get Boxscore for today
today1 - Get Boxscore for yesterday
today2 - Get Boxscore for day before yesterday
today3 - Get Boxscore for 3 days ago
today4 - Get Boxscore for 4 days ago
today5 - Get Boxscore for 5 days ago
season - Refresh Boxscores for all games this season
html - Generate HTML for all of a team's games in a season
html/all - Run ALL existing XML files through XSLT (!!)
function do_generate_html
Get XML files for a given season and team, and generate HTML files from them.
function do_generate_html_all
Generate all HTML. Uses the object's XSLT to process all existing XML files.
function do_refresh_season
Reload XML files for a given season [and given team] (forced GET, XML saved).
function get_boxscore
Get GameDay BoxScore XML for a given Date and TeamCode. Save XML and HTML.
type GameDayBoxScore
Box Score Class.
Get Box Score for a given game.
properties:
.gameId "game_id"
.dt "date"
.flag "status_ind"
.venue "venue_name"
.venueId "venue_id"
.gameInfo "game_info" (CDATA)
.{away|home}Id "away_id|home_id"
.{away|home}FName "away_fname|home_fname"
.{away|home}SName "away_sname|home_sname"
.{away|home}Code "away_team_code|home_team_code"
.homeSport "home_sport_code"
.{away|home}Wins "away_wins|home_wins"
.{away|home}Loss "away_loss|home_loss"
.{away|home}Hits "linescore/away_team_runs|linescore/home_team_runs"
.{away|home}Runs "linescore/away_team_hits|linescore/home_team_hits"
.{away|home}Errs "linescore/away_team_errors|linescore/home_team_errors"
.innings - number of innings
.{away|home}Box "inning_line_score/{away|home}" (array of inning scores)
.{away|home}Batting "batting/@" [boxBattingStats]
.{away|home}Batters[] "batting/batter/@" [boxBatter]
.{away|home}Pitching "pitching/@" [boxPitchingStats]
.{away|home}Pitchers[] "pitching/pitcher/@" [boxPitcher]
methods:
.filename() - "boxscore.xml"
.pathname() - "boxscore"
.save_html() - generate HTML using XSLT from XML
len(obj) - number of innings
str(obj) - Box Score string
repr(obj) - JSON-like string
type boxBatter
Box Score Batter Class.
properties:
.pid "id" - Player ID
.pos "pos" - Player Position
.name "name" - Player Name
.player "name_display_first_last"
.note "note"
.avg "avg" - Batting Average
.fldg "fldg" - Fielding Percentage
.s_h "s_h" - Season Hits
.s_r "s_r" - Season Runs
.s_hr "s_hr" - Season Home Runs
.s_rbi "s_rbi" - Season Runs Batted In
.s_bb "s_bb" - Season Walks
.s_so "s_so" - Season Strike Outs
.bo "bo" - Game Batting Order
.ab "ab" - Game At Bats
.pa - calculated: AB + BB + HBP + SAC + SF
.h "h" - Game Hits
.d "d" - Game Doubles
.t "t" - Game Triples
.r "r" - Game Runs
.hr "hr" - Game Home Runs
.rbi "rbi" - Game Runs Batted In
.bb "bb" - Game Walks
.hbp "hbp" - Game Hit by Pitch
.sb "sb" - Game Stolen Base
.so "so" - Game Strike Outs
.po "po" - Game Put Out
.sac "sac" - Game Sacrifices
.sf "sf" - Game Sacrifice Flys
.lob "lob" - Game Left on Base
.gidp "gdip" - Game Grounded into Double Play
.ao "ao" - Game
.go "go" - Game
.a "a" - Game
.da "da" - Game
.e "e" - Game Errors
methods:
.data() - return data tuple
str(obj) - return data string
repr(obj) - JSON-like string
type boxBattingStats
Box Score Batting Stats Class.
properties:
.ab "ab" - at bats
.r "r" - runs
.h "h" - hits
.d "d" - doubles
.t "t" - triples
.hr "hr" - home runs
.rbi "rbi" - runs batted in
.bb "bb" - base on balls
.so "so" - strike outs
.po "po" - put outs
.da "da"
.lob "lob" - left on base
.avg "avg" - batting average
.textInfo "text_data" (CDATA)
methods:
.data() - return data tuple
.header() - return data header string
str(obj) - return data string
repr(obj) - JSON-like string
type boxPitcher
Box Score Pitcher Class.
properties:
.pid "pid" - Player ID
.pos "pos" - Player Position
.name "name" - Player Name
.player "name_display_first_last"
.note "note"
.w "w" - wins
.l "l" - losses
.era "era" - ERA (season)
.whip - calculated: ((BB+H) / Outs) * 3.0
.s_ip "s_ip" - Season Innings pitched (floating point: 1.1, 4.2, 8.0)
.s_er "s_er" - Season Earned Runs
.s_h "s_h" - Season Hits
.s_r "s_r" - Season Runs
.s_so "s_so" - Season Strike Outs
.s_bb "s_bb" - Season Walks
.bf "bf" - Game Batters Faced
.out "out" - Game Outs (IP * 3)
.er "er" - Game Earned Runs
.h "h" - Game Hits
.r "r" - Game Runs
.hr "hr" - Game Home Runs
.so "so" - Game Strike Outs
.bb "bb" - Game Walks
.sv "sv" - Game Save
.bs "bs" - Game Blown Save
.hld "hld" - Game Hold
.w_flag "win" - Game Win Flag
.l_flag "loss" - Game Lose Flag
.sv_flag "save" - Game Save Flag
.bs_flag "blown_save" - Game Blown Save Flag
methods:
.data() - return data tuple
str(obj) - return data string
repr(obj) - JSON-like string
type boxPitchingStats
Box Score Pitching Stats Class.
properties:
.bf "bf" - batters faced
.out "out" - outs
.er "er" - earned runs
.h "h" - hits
.r "r" - runs
.hr "hr" - home runs
.so "so" - strike outs
.bb "bb" - base on balls
.era "era" - earned run average
methods:
.data() - return data tuple
.header() - return data header string
str(obj) - return data string
repr(obj) - JSON-like string
type boxPlayer
Box Score Player Base Class.
methods:
.data() - return data tuple
.header() - return data header string