Baseball Files

gameday_msb

GameDay XML - MSB (Master ScoreBoard).

http://gd2.mlb.com/components/game/mlb/year_####/month_##/day_##/master_scoreboard.xml

classes:
    GameDayMSB (GameDayXML)
    msbGame (GameDayGameInfo)

functions:
    last_n_games    (n,tc,from_date)    -
    dispatch        (cmd,[args])        - Module Command Dispatch
    main            ()                  - Default function
    RefreshDates    (dts)               - Reload XML files (forceGET=True)
    RefreshMonth    (mon,yr)            - Reload Month XML files (forceGET=True)
    RefreshSeason   (yr)                - Reload Season XML files (forceGET=True)
    GenerateAllHTML ()                  - Run XSLT on all XML files

Developer@Sonnack.com
December 2011

function GenerateAllHTML

Generate all HTML. Uses the object's XSLT to process all existing XML files.

function RefreshDates

Refresh database (forced GET, save XML & HTML) given a List of Dates.

function RefreshMonth

Refresh database (forced GET, save XML & HTML) for a given Month (default to this one).

function RefreshSeason

Refresh database (forced GET, save XML & HTML) for a given Season (year).

function dispatch

Dispatch Command.

usage:
    gameday_msb [command] [date=None] [forceGET=False]

commands:
    main            - Default function
    spcl            - Special function
    today           - Get MSB for today
    today1          - Get MSB for yesterday
    today2          - Get MSB for day before yesterday
    today3          - Get MSB for 3 days ago
    today4          - Get MSB for 4 days ago
    today5          - Get MSB for 5 days ago
    last3           - Get MSB for last 3 days
    last5           - Get MSB for last 5 days
    last10          - Get MSB for last 10 days
    RefreshMonth    - Reload all MSB files for the month (thru today)
    RefreshSeason   - Reload all MSB files for the Season
    GenerateAllHTML - Regenerate all HTML from the XML

function main

Get an MSB object for a given date.

type GameDayMSB

GameDay Master Scoreboard (MSB) Class.
Get Master Scoreboard for a given date.

properties:
    .games                  - array of msbGame objects
    .nxdt                   - Next Day Date ('next_day_date')
    .dt                     - Scoreboard Date ('year' + 'month' + 'day')
    .updt                   - Last Update ('modified_date')

methods:
    .find_team(t)           - get a Game[] given a Team code or name
    .list_games()           - print Scoreboards listing
    .list_games_brief()     - print Scoreboards listing (brief)
    .print_header()         - print listing header
    .date_str()             - printable .dt
    .update_str()           - printable .updt
    .next_date_str()        - printable .nxdt
    .filename()             - "master_scoreboard.xml"
    .save_html()            - generate HTML using XSLT from XML
    len(obj)                - number of scoreboards
    cmp(obj)                - compare date; compare update-date
    iter(obj)               - get scoreboards iterator
    obj[index]              - get a given scoreboard
    str(obj)                - string: Date, Update, # Games
    repr(obj)               - JSON-like string

type msbGame

GameDay Master Scoreboard XML Game.
An object instance that encapsulates a '<games><game>' DOM Element.

GameDayGameInfo.gtype:
    R   Regular game
    F   Wildcard game (?)
    D   Division Championship game
    L   League Championship game
    W   World Series game
    S   Spring Training game
    A   All-Star game (?)

msbGame.flag; msbGame.status:
    F   Final
    FT  "
    FR  Completed Early
    DC  Postponed
    DI  "
    DR  "
    DS  "
    CA  Cancelled
    CO  "

properties:
    .dt             url date
    .nid            "id"
    .status         "status/status"
    .inning         "status/inning"
    .balls          "status/b"
    .strikes        "status/s"
    .outs           "status/o"
    .flag_top       "status/top_inning"
    .flag           "status/ind"
    .diffRuns       "linescore/r/diff"
    .awayRuns       "linescore/r/away"
    .awayHits       "linescore/h/away"
    .awayErrs       "linescore/e/away"
    .homeRuns       "linescore/r/home"
    .homeHits       "linescore/h/home"
    .homeErrs       "linescore/e/home"
    .inning[]       "linescore/inning[]"  --array of tuples: (away, home)
    :WP             "winning_pitcher/@"
    :LP             "losing_pitcher/@"
    :SP             "save_pitcher/@"

methods:
    str(obj)        - s/a .long_str()
    repr(obj)       - JSON (sort of)