Skip to content
paaatrickPublic

About

Watch MLB games from the comfort of your own terminal

Resources

Code of conduct

Stars

1.2k stars

Watchers

12 watching

Forks

Repository files navigation

Playball!

Watch MLB games from the comfort of your own terminal

screenshot

Why?

MLB Gameday and MLB.tv are great, but sometimes you want to keep an eye on a game a bit more discreetly. playball puts the game in a terminal window.

Quick Start

Just want to try it out?

$ npx playball

Install

Ready for the big leagues? Install the package globally

$ npm install -g playball

Then run it

$ playball

Docker

Don't have Node.js installed? You can run via Docker instead.

$ docker run -it --rm paaatrick0/playball

Tip

When running via Docker, times will be shown by default in Eastern Time. To change this, set the TZ environment variable to your desired timezone.

For Central Time use:

$ docker run -it --rm -e TZ=America/Chicago paaatrick0/playball

For Mountain Time use:

$ docker run -it --rm -e TZ=America/Denver paaatrick0/playball

For Pacific Time use:

$ docker run -it --rm -e TZ=America/Los_Angeles paaatrick0/playball

For other timezones see the list of TZ database time zones.

Keys

Global

key action
q quit
c go to schedule view
s go to standings view

Schedule View

key action
↓/j, ↑/k, ←/h, →/l change highlighted game
enter view highlighted game
p show previous day's schedule/results
n show next day's schedule
t return to today's schedule

Game View

key action
↓/j, ↑/k scroll list of all plays

World Baseball Classic

Watch World Baseball Classic games by setting the sport configuration:

playball config sport wbc

Or use an environment variable for one-time viewing:

PLAYBALL_SPORT=wbc playball

To switch back to MLB:

playball config sport mlb

When running via Docker:

docker run -it --rm -e PLAYBALL_SPORT=wbc paaatrick0/playball

Configuration

Playball can be configured using the config subcommand. To list the current configuration values run the subcommand with no additional arguments:

playball config

You should see output similar to:

color.ball = green
color.favorite-star = yellow
color.in-play-no-out = blue
color.in-play-out = white
color.in-play-runs-bg = white
color.in-play-runs-fg = black
color.on-base = yellow
color.other-event = white
color.out = red
color.strike = red
color.strike-out = red
color.walk = green
favorites = 

To get the value of a single setting pass the key as an additional argument:

playball config color.strike

To change a setting pass the key and value as arguments:

playball config color.strike blue

To revert a setting to its default value provide the key and the --unset flag:

playball config color.strike --unset

Every setting can also be overridden for a single run with an environment variable, without persisting it to the config file. Take the key, uppercase it, and replace . and - with _, then prefix with PLAYBALL_. For example live-delay becomes PLAYBALL_LIVE_DELAY and color.on-base becomes PLAYBALL_COLOR_ON_BASE:

PLAYBALL_LIVE_DELAY=30 playball

This is especially useful with Docker, since a --rm container has no way to persist playball config changes between runs:

docker run -it --rm -e PLAYBALL_LIVE_DELAY=30 paaatrick0/playball

This table summarizes the available settings:

key env variable description default allowed values
color.ball PLAYBALL_COLOR_BALL Color of dots representing balls in top row of game view green One of the following: black, red, green, yellow, blue, magenta, cyan, white, grey. Any of those colors may be prefixed by bright- or light- (for example bright-green). The exact color used will depend on your terminal settings. The value default may be used to specify the default text color for your terminal. Finally hex colors (e.g #FFA500) can be specified. If your terminal does not support true color, the closest supported color may be used.
color.favorite-star PLAYBALL_COLOR_FAVORITE_STAR Color of star indiciating favorite team in schedule and standing views yellow See above
color.in-play-no-out PLAYBALL_COLOR_IN_PLAY_NO_OUT Color of result where ball was put in play and no out was made (single, double, etc) in list of plays in game view blue See above
color.in-play-out PLAYBALL_COLOR_IN_PLAY_OUT Color of result where ball was put in play and an out was made (flyout, fielder's choice, etc) in list of plays in game view white See above
color.in-play-runs-bg PLAYBALL_COLOR_IN_PLAY_RUNS_BG Background color for score update in list of plays in game view white See above
color.in-play-runs-fg PLAYBALL_COLOR_IN_PLAY_RUNS_FG Foreground color for score update in list of plays in game view black See above
color.on-base PLAYBALL_COLOR_ON_BASE Color of diamonds representing runners on base in top row of game view yellow See above
color.other-event PLAYBALL_COLOR_OTHER_EVENT Color of other events (mound visit, injury delay, etc) in list of plays in game view white See above
color.out PLAYBALL_COLOR_OUT Color of dots representing outs in top row of game view red See above
color.strike PLAYBALL_COLOR_STRIKE Color of dots representing strikes in top row of game view red See above
color.strike-out PLAYBALL_COLOR_STRIKE_OUT Color of result where play ends on a strike (strike out) in list of plays in game view red See above
color.walk PLAYBALL_COLOR_WALK Color of result where play ends on a ball (walk, hit by pitch) in list of plays in game view green See above
favorites PLAYBALL_FAVORITES Teams to highlight in schedule and standings views Any one of the following: ATL, AZ, BAL, BOS, CHC, CIN, CLE, COL, CWS, DET, HOU, KC, LAA, LAD, MIA, MIL, MIN, NYM, NYY, OAK, PHI, PIT, SD, SEA, SF, STL, TB, TEX, TOR, WSH. Or a comma-separated list of multiple (e.g. SEA,MIL).

Note: in some terminals the list must be quoted: playball config favorites "SEA,MIL"
sort-by-favorites PLAYBALL_SORT_BY_FAVORITES Sort games with favorite teams first in the schedule view false false, true
title PLAYBALL_TITLE If enabled, the terminal title will be set to the score of the current game false false, true
live-delay PLAYBALL_LIVE_DELAY Number of seconds to delay the live game stream. Useful when watching with delayed broadcast streams. 0 (no delay) Any positive number
sport PLAYBALL_SPORT Which sport/league to display mlb mlb, wbc

Development

git clone https://github.com/paaatrick/playball.git
cd playball
npm install
npm start

Contributions are welcome!

About

Watch MLB games from the comfort of your own terminal

Resources

Code of conduct

Stars

1.2k stars

Watchers

12 watching

Forks

Releases

Packages

Used by

Contributors

Languages