Hacker News new | past | comments | ask | show | jobs | submit login
Playball: Watch MLB games from the comfort of your own terminal (github.com/paaatrick)
196 points by computerlab on Nov 28, 2019 | hide | past | favorite | 42 comments

I was really hoping this would render a small video in terminal colors.

Regardless, love it and love that you're bringing baseball to it's biggest new market, unix sysadmins.

You can do that with mpv pretty easily.

mpv "http://SOURCEURL" --vo=caca


mpv "https://www.youtube.com/watch?v=xYQiqBwczB0" --vo=caca

OR, for a higher-quality terminal-rendered video:

mpv "https://www.youtube.com/watch?v=xYQiqBwczB0" --vo=tct

Do you have a Youtube example of the output?

There's plenty results if you search for libcaca


this was really useful, thank you

Always happy to share!

Baseball’s state and state transitions are easily serializable, no need for a lossy video stream :)

I don't even really like Baseball that much but I love everything about this. I love terminal apps for things you'd never think of, especially when they're fully-featured and beautiful such as this. This has no business existing - yet here we are...and it's amazing.

The developer also created a visualization of each team's minor league system [1]. It's an interesting visualization and a useful project [2] that shows the entire data analysis process from scraping data to published visualization.

[1] https://paaatrick.github.io/called-up/

[2] https://github.com/paaatrick/called-up

Love this.

When I worked remotely, I would frequently have the radio playing a baseball game in the background for company. Now I'm back in the office and can't do that, so this would have been great to have a few months ago.

Bookmarked for next season.

The MLB seems refreshingly progressive in providing a free API (although from reading around it seems to be poorly documented).

The EPL by contrast jealously guards its stats and charges for every tidbit.

My understanding (mainly from Star Trek) is that most of the fun of baseball is the stats.

There needs to be a cricket version of this (especially with 5 day test matches). I don't know if the raw data is available without crazy licensing though.

I've been using SportMonks for football data and they do cricket too: https://www.sportmonks.com/cricket-api

Well this makes me appreciate the NHL/NFL/NBA/MLB free apis.

I've been using the free version of the football API from SportMonks whilst I write a client, but it's limited to just a few (not so popular) leagues. I intend on using it for commercial purposes in a few months though, and the price compared to Opta and SportRadar is much more reasonable.

As a weekend hack you could probably scrape cricinfo - used to do that with a shell script and the notify method in linux to pop up cricket scores.

That seems to be the blocker for a lot of sports stuff. Is there a freely available API?

I wonder how difficult it would be to make this work with /r/MLBstreams, eventually even integrating the live match thread from /r/baseball on the side of the main screen.

Too bad you'll be missing a lot of the game experience this way, like the roar of the crowd and the banging of trashcans.

For those out of the loop, the Houston Astros have been accused of stealing signs between the pitcher and catcher by banging on a trash can in the dugout using a camera placed in center field.


There's more to it than just sign stealing. The Astros were the team that, allegedly, made "Moneyball" work well enough to win the Last Game of The Season. That they've been accused of stealing signs is a stain on that legacy.

[1] https://www.si.com/longform/astros/index.html [2] https://www.si.com/mlb/2017/10/24/houston-astros-sports-illu...

So the guy catching the ball tells the guy throwing the ball how to throw the ball?

And the other team is seeing what he's telling the thrower, and then signalling that to the batter so he knows how the ball is going to be thrown?

And this is disallowed ?

yet stealing bases is allowed?

There is a lot more going on in baseball than I thought!

> So the guy catching the ball tells the guy throwing the ball how to throw the ball?

Not quite. The catcher benefits from knowing the type of pitch in order to actually catch the ball, but only signals pitch options which are accepted or rejected by the pitcher.

They can also huddle if signs are being stolen, but this of course takes much longer (hence the prohibition on sign stealing).

A small correction, stealing signs is not disallowed, and pitchers and catchers will have different sets of signs they use when there is a runner on second base. What is disallowed is the use of technology to steal signs, the camera in center field going to the TV behind the dugout

Sorry, not American but this seems an interesting aspect of a sport I know nothing about!

Is this done because the catcher might know the batter is worse at hitting pitch type X, but is better at pitch type Y, so signals to the pitcher to throw an X?

But the pitcher might think he can't throw a good X right now (for whatever reason), and instead will throw a Z ?

And the pitcher and catcher need to somehow secretly agree on what's being thrown?

Does it ever happen that the catcher fails to catch it? It seems he has a pretty small window that he needs to catch it in, but then I guess sometimes these pitches are crazy fast and can't have much time to react.

Yes, the catcher does miss the ball occasionally. It's common for the pitches to be 90 MPH or higher. I've seen them as high as 104 MPH. The ball will also move; it's not always thrown in a straight line. Some times it cuts across the plate, other times it can drop as it crosses the plate. If the catcher knows where to expect the ball they have a higher probability of catching it.

To be specific, what is disallowed is using technology to steal signs (the camera). You can steal signs if there is a runner on second, although the pitcher and catcher can then change signs. It's one of the 'unwritten rules' in that it happens but they try to be sneaky about it. You don't want to disrespect the other team. More often with good scouting hitters can get an advantage of the pitcher is 'tipping the pitch', i.e. using a different delivery or setup depending on what pitch is coming. For instance, how high they hold the glove

Whenever I'm asked how I managed to do something and want to keep it mysterious, I always plead ignorance and say that Machine Learning told me to do it.

There should be a dB indicator telling you how noisy the crowd is.

Out of curiosity, what are some of the advantages of making terminal apps via JS/npm? I've been curious in making some of my own, but I've looked mostly at ncurses in C or Rust, and haven't looked much at the JS ecosystem.

I'm not a JS expert but the code was an interesting read.

Are there other free sports API's out there? The MLB one is cool.

There is an NHL API documented here: https://gitlab.com/dword4/nhlapi

MLB API documentation should be very similar. Both were built by MLB Advanced Media.

I believe there is one for NBA basketball, too. Someone posted a terminal program for reading its scores on HN once, but since I have no interest in basketball, I didn't bookmark it.

Back in the day you could watch the Soccer World Cup over telnet.




I've seen it mentioned here that there are free apis ordained by the sports leagues but I was under the impression that this type of live data is not free.

I know there has been many court cases around this very issue so the question is; are these apis really provided by the leagues?

MLB actually has two different APIs - their statcast API and their Gameday API.

Both are free for non-commercial uses, though there is no documentation available (any more), and any copies of the older documentation is riddled with incorrect details.

Does anyone have something similar like this for EPL football/soccer?

Very cool! I don't watch baseball but still find this fascinating :D

This is really neat -- I would absolutely love an NFL equivalent!

Anyone know if there is something similar for cricket?

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact