Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runners on Base #54

Closed
ajbowler opened this issue Jan 22, 2018 · 5 comments
Closed

Runners on Base #54

ajbowler opened this issue Jan 22, 2018 · 5 comments

Comments

@ajbowler
Copy link
Contributor

ajbowler commented Jan 22, 2018

I'm currently working on an MLB scoreboard on an LED board in preparation for the upcoming season and am planning on using this very interesting API.

image

The above image is similar to what I'm going for here.

It'd be wonderful to get some data for occupied bases, balls/strikes count, and current number of outs. I can file separate issues for the balls/strikes and outs if needed.

Would you accept a pull request for this feature? If so, any ideas where to start? I'm not very familiar with the XML files this API is pulling from.

@ajbowler
Copy link
Contributor Author

ajbowler commented Jan 22, 2018

This will probably require some trial and error after the season starts to see how MLB's writeouts to the XMLs work during a live game but the inning XMLs might be of some use. Assuming their innings and at-bats are always sorted we could just traverse the tree to get the latest at-bat. It has a <runner> property for every runner on base at the time.

@trevor-viljoen
Copy link
Contributor

trevor-viljoen commented Jan 22, 2018

If I remember correctly, there is a file that gets updated with that information during the game. It may be one of the scoreboard.xml files, but I can't remember. Once spring training starts up I'll make note of it.

There is a status tag with ball, strikes, outs, and "inning_state":

<status status="Final" ind="F" reason="" inning="9" top_inning="N" b="0" s="0" o="3" inning_state="" note="" is_perfect_game="N" is_no_hitter="N"/>

@ajbowler
Copy link
Contributor Author

@trevor-viljoen I'll open a separate issue for balls/strikes/outs, I'd like to keep this one open for runners on base.

@ajbowler ajbowler changed the title Bases information Runners on Base Jan 22, 2018
@ajbowler
Copy link
Contributor Author

ajbowler commented Jan 22, 2018

It looks like game_events.xml has some atbat tags for each inning that we can get the latest from. It has b1, b2, and b3 properties that are set to the player ID of whoever is on that base, and the atbat also has the pitches that have been thrown.

The existing events module should suffice for this.

@Fustrate
Copy link

Fustrate commented Jan 28, 2018

You can also use linescore.xml's runner_on_base_status value like I did here if you're not interested in who exactly is on base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants