Git Product home page Git Product logo

mlb-led-scoreboard's Introduction

mlb-led-scoreboard

Current Version

Join Discord

Project header

Important

If you are upgrading from v7 to v8, please be sure to read the Usage section, as the startup commands have changed!


An LED scoreboard for Major League Baseball. Displays a live scoreboard for your team's game on that day.

Requires a Raspberry Pi and an LED board hooked up via the GPIO pins.

Currently supported boards:

  • 32x32 (Limited number of features)
  • 64x32 (the most supported)
  • 64x64
  • 128x32
  • 128x64

If you'd like to see support for another set of board dimensions, or have design suggestions for an existing one, file an issue!

Pi's with known issues

  • Raspberry Pi Zero has had numerous reports of slowness and unreliability during installation and running the software.

Table of Contents

Features

Live Games

It can display live games in action, and optionally rotate every 15 seconds through each game of the day.

The board refreshes the list of games every 15 minutes.

Cubs-Indians game Pirates-Cubs game Cubs-Braves Final 64x64 example Giants-Brewers-wide game Tigers-Royals game

Pregame

If a game hasn't started yet, a pregame screen will be displayed with the probable starting pitchers.

Pregame Astros-Athletics pregame

Division Standings

It can display standings for the provided division. Since the 32x32 board is too small to display wins and losses together, the wins and losses are alternated on the board every 5 seconds. You can also specify "NL Wild Card" or "AL Wild Card" as a 'division' to see the top 5 teams in each league's wild card race.

standings-wins standings-losses standings-wide

Installation

Hardware Assembly

See the wiki page for the original project for a step-by-step guide. This README is primarily focused on the MLB software, but for those coming here from Reddit or elsewhere never having built things with a Raspberry Pi, this should help get you going.

A sample bill of materials (BOM) is located here

Software Installation

Requirements

You need Git for cloning this repo and PIP for installing the scoreboard software.

sudo apt-get update
sudo apt-get install git python3-pip

Installing the scoreboard software

This installation process will take about 10-15 minutes. Raspberry Pis aren't the fastest of computers, so be patient!

git clone https://github.com/MLB-LED-Scoreboard/mlb-led-scoreboard.git
cd mlb-led-scoreboard/
sudo ./install.sh

This will create a Python Virtual Environment and install all of the required dependencies. The virtual environment will be located at mlb-led-scoreboard/venv/.

This will install the rgbmatrix binaries, which we get from another open source library. It controls the actual rendering of the scoreboard onto the LEDs. If you're curious, you can read through their documentation on how all of the lower level stuff works.

It will also install the following python libraries that are required for certain parts of the scoreboard to function.

  • tzlocal: Timezone libraries. These allow the scoreboard to convert times to your local timezone
  • feedparser: Used to fetch and parse RSS feeds. The scoreboard uses this to show news headlines.
  • pyowm: OpenWeatherMap API interactions. We use this to get the local weather for display on the offday screen. For more information on how to finish setting up the weather, visit the weather section of this README.
  • MLB-StatsAPI: The main library that fetches and parses all of the actual MLB data being displayed
  • RGBMatrixEmulator: The emulation library for the matrix display. Useful for running on MacOS or Linux, or for development.

Installation on Non-Raspberry Pi Hardware

The installation script is designed for physical hardware. When attempting to install it on other platforms, you should not use sudo to install the dependencies. In addition, you can pass the --emulator-only argument to skip installation steps that aren't required.

sh install.sh --emulator-only

Additional flags are available for customizing your install:

-p, --skip-python  Skips Python 3 installation. You will need to install it via your platform's appropriate package manager.
-m, --skip-matrix  Skips RPI-specific matrix driver installation and build.
-c, --skip-config  Skips default config overwrite without prompting.

-a, --skip-all     Performs all above skips.
--no-venv          Do not create a virtual environment for the dependencies.
--emulator-only    Do not install dependencies under sudo. Skips building matrix dependencies.

-h, --help         Displays help

Updating

  • Run git pull in your mlb-led-scoreboard folder to fetch the latest changes. A lot of the time, this will be enough, but if something seems broken:
    • Re-run the install file. Run sudo ./install.sh again. Any additional dependencies that were added with the update will be installed this way. If you are moving to a new major release version, answer "Y" to have it make you a new config file.
    • Check your custom layout/color files if you made any. There's a good chance some new keys were added to the layout and color files. These changes should just merge right in with the customized .json file you have but you might want to look at the new .json.example files and see if there's anything new you want to customize.

That should be it! Your latest version should now be working with whatever new fangled features were just added.

Version Information

You can check the version information for your installation of mlb-led-scoreboard by running python3 version.py.

The latest version of the software is available here.

Time Zones

Make sure your Raspberry Pi's timezone is configured to your local time zone. They'll often have London time on them by default. You can change the timezone of your raspberry pi by running sudo raspi-config.

Usage

The installation script adds a line to the top of main.py to automatically pick up the virtual environment. This means re-activating the environment (source ./venv/bin/activate) is not a requirement.

sudo ./main.py Running as root is 100% an absolute must, or the matrix won't render.

Adafruit HAT/Bonnet users: You must supply a command line flag:

sudo ./main.py --led-gpio-mapping="adafruit-hat"

See the Flags section below for more flags you can optionally provide.

Running on Other Platforms

The scoreboard can run on other platforms by means of software emulation via RGBMatrixEmulator. When running via the emulator, you do not need to prepend your startup commands with sudo:

./main.py

You can also force the scoreboard into emulation mode by using the --emulated flag:

./main.py --emulated

When running in emulation mode, you can continue to use your existing command line flags as normal.

See RGBMatrixEmulator for emulator configuration options.

Configuration

A default config.json.example file is included for reference. Copy this file to config.json and modify the values as needed.

"preferred":                             Options for team and division preference
  "teams"                        Array   An array of preferred teams. The first team in the list will be used as your 'favorite' team. Example: ["Cubs", "Brewers"]
  "divisions"                    Array   An array of preferred divisions that will be rotated through in the order they are entered. Example: ["NL Central", "AL Central"]

"news_ticker":                           Options for displaying a nice clock/weather/news ticker screen
  "always_display"               Bool    Display the news ticker screen at all times. Supercedes the standings setting.
  "team_offday"                  Bool    Display the news ticker when your prefered team is on an offday.
  "preferred_teams"              Bool    Include headlines from your list of preferred teams. Will only use the first 3 teams listed in your preferred teams.
  "display_no_games_live"        Bool    Display news and weather when none of your games are currently live.
  "traderumors"                  Bool    Include headlines from mlbtraderumors.com for your list of preferred teams. Will only use the first 3 teams listed in your preferred teams.
  "mlb_news"                     Bool    Include MLB's frontpage news.
  "countdowns"                   Bool    Include various countdowns in the ticker.
  "date"                         Bool    Display today's date to start the ticker. This will always be enabled if no other ticker options are.
  "date_format"                  String  Display the date with a given format. You can check all of the date formatting options at https://strftime.org

"standings":                             Options for displaying standings for a division
  "always_display"               Bool    Display standings for your preferred divisions.
  "mlb_offday"                   Bool    Display standings for your preferred divisions when there are no games on the current day.
  "team_offday"                  Bool    Display standings for your preferred divisions when the one of your preferred teams is not playing on the current day.
  "display_no_games_live"        Bool    Display standings when none of your games are currently live.

"rotation":                              Options for rotation through the day's games
  "enabled"                      Bool    Rotate through each game of the day according to the configured `rates`.
  "scroll_until_finished"        Bool    If scrolling text takes longer than the rotation rate, wait to rotate until scrolling is done.
  "only_preferred"               Bool    Only rotate through games in your preferred teams.
  "only_live"                    Bool    Only rotate through games which are currently playing. Can be composed with `only_preferred`.
  "rates"                        Dict    Dictionary of Floats. Each type of screen can use a different rotation rate. Valid types: "live", "pregame", "final".
                                 Float   (DEPRECATED) A Float can be used to set all screen types to the same rotate rate.

  "while_preferred_team_live":           Options for rotating between screens while one of your preferred teams is live
    "enabled"                    Bool    Enable rotation while a preferred team is live.
    "during_inning_breaks"       Bool    Enable rotation while a preferred team is live during an inning break.

"weather":                               Options for retrieving the weather
  "apikey"                       String  An API key is required to use the weather service.
                                         You can get one for free at Open Weather Map (https://home.openweathermap.org/users/sign_up).
  "location"                     String  The `{city name},{state code},{country code}` according to ISO-3166 standards (https://www.iso.org/obp/ui/#search).
                                         Check out the OpenWeather documentation (https://openweathermap.org/current#name) for more info.
                                         Ex: `"Chicago,il,us"`
  "metric_units"                 Bool    Change the weather display to metric units (Celsius, m/s) instead of imperial (Fahrenheit, MPH).

"time_format"                    String  Sets the preferred hour format for displaying time. Accepted values are "12h" or "24h" depending on which you prefer.
"end_of_day"                     String  A 24-hour time you wish to consider the end of the previous day before starting to display the current day's games. Uses local time from your Pi.
"full_team_names"                Bool    If enabled on a board width >= 64, displays the full team name on the scoreboard instead of their abbreviation. This config option is ignored on 32-wide boards.
"short_team_names_for_runs_hits" Bool    If full_team_names is enabled, will use abreviated team names when runs or hits > 9 to prevent overflow of long names into RHE.
"scrolling_speed"                Integer Sets how fast the scrolling text scrolls. Supports an integer between 0 and 6.
"preferred_game_update_delay_in_10s_of_seconds" Integer Sets how long to wait before updating the preferred game. Must be positive.
"pregame_weather"                Bool    If enabled, will display the weather for the game's location on the pregame screen.
"debug"                          Bool    Game and other debug data is written to your console.
"demo_date"                      String  A date in the format YYYY-MM-DD from which to pull data to demonstrate the scoreboard. A value of `false` will disable demo mode.

Delaying Board Update

  • The "preferred_game_update_delay_in_10s_of_seconds" will delay the update of your LED board to allow you to synchronize with the boroadcast feed.
  • You can only delay the board in 10 second increments, so a value of 3 coresponds to 30 seconds, 5 to 50 seconds etc.
  • There appears to be a lot of variability in broadcast delays across networks/teams/CDN's.
  • Please note, that if restarting the service with a delay, it will take the value of cycles set for the board to be in sync. If you set the value to 3, it will take 30-40 seconds for the buffer to fill and the board to delay.

Additional Features

  • Runs/Hits/Errors - Runs are always shown on the games screen, but you can enable or adjust spacing of a "runs, hits, errors" display. Take a look at the coordinates readme file for details.

  • Pitch Data - Pitch data can be shown on the game screen, See the coordinates readme file for details. In addition, the short and long pitch description can be changed in data/pitches.py

  • Previous Play Data - Data for the previous play can be shown on the game screen. See the coordinates readme file for details. Long and short play descriptions can be changed in data/plays.py

    • NOTE: Because play result data is ephemeral, not every play result will be displayed. Situations like a mound visit, injury, or other timeout immediately following a play often cause the play result to be immediately replaced on the MLB API.

Flags

You can configure your LED matrix with the same flags used in the rpi-rgb-led-matrix library. More information on these arguments can be found in the library documentation.

--led-rows                Display rows. 16 for 16x32, 32 for 32x32. (Default: 32)
--led-cols                Panel columns. Typically 32 or 64. (Default: 32)
--led-chain               Daisy-chained boards. (Default: 1)
--led-parallel            For Plus-models or RPi2: parallel chains. 1..3. (Default: 1)
--led-pwm-bits            Bits used for PWM. Range 1..11. (Default: 11)
--led-brightness          Sets brightness level. Range: 1..100. (Default: 100)
--led-gpio-mapping        Hardware Mapping: regular, adafruit-hat, adafruit-hat-pwm
--led-scan-mode           Progressive or interlaced scan. 0 = Progressive, 1 = Interlaced. (Default: 1)
--led-pwm-lsb-nanosecond  Base time-unit for the on-time in the lowest significant bit in nanoseconds. (Default: 130)
--led-show-refresh        Shows the current refresh rate of the LED panel.
--led-slowdown-gpio       Slow down writing to GPIO. Range: 0..4. (Default: 1)
--led-no-hardware-pulse   Don't use hardware pin-pulse generation.
--led-rgb-sequence        Switch if your matrix has led colors swapped. (Default: RGB)
--led-pixel-mapper        Apply pixel mappers. e.g Rotate:90, U-mapper
--led-row-addr-type       0 = default; 1 = AB-addressed panels. (Default: 0)
--led-multiplexing        Multiplexing type: 0 = direct; 1 = strip; 2 = checker; 3 = spiral; 4 = Z-strip; 5 = ZnMirrorZStripe; 6 = coreman; 7 = Kaler2Scan; 8 = ZStripeUneven. (Default: 0)
--led-limit-refresh       Limit refresh rate to this frequency in Hz. Useful to keep a constant refresh rate on loaded system. 0=no limit. Default: 0
--led-pwm-dither-bits     Time dithering of lower bits (Default: 0)
--config                  Specify a configuration file name other, omitting json xtn (Default: config)
--emulated                Force the scoreboard to run in software emulation mode.
--drop-privileges         Force the matrix driver to drop root privileges after setup. (Default: true)

Personalization

If you're feeling adventurous (and we highly encourage it!), the sections below outline how you can truly personalize your scoreboard and make it your own!

Custom Board Layout

You have the ability to customize the way things are placed on the board (maybe you would prefer to see scrolling text for a pregame a bit higher or lower). See the coordinates/ directory for more information.

Custom Colors

You have the ability to customize the colors of everything on the board. See the colors/ directory for more information.

Weather

This scoreboard will use a weather API to gather weather information at various times. This information is displayed on your teams' offdays for your area and also displayed during each game's pregame information. The weather API we use is from OpenWeatherMaps. OpenWeatherMaps API requires an API key to fetch this data so you will need to take a quick minute to sign up for an account and copy your own API key into your config.json.

You can find the signup page for OpenWeatherMaps at https://home.openweathermap.org/users/sign_up. Once logged in, you'll find an API keys tab where you'll find a default key was already created for you. You can copy this key and paste it into the config.json under "weather", "apikey".

You can change the location used by entering your city, state, and country code separated by commas. If you wish to use metric measurements, set the "metric" option to true.

Sources

This project relies on two libraries: MLB-StatsAPI is the Python library used for retrieving live game data. rpi-rgb-led-matrix is the library used for making everything work with the LED board.

Accuracy Disclaimer

The scoreboard updates frequently, but it cannot retrieve information that MLB has not yet made available. If something is odd or it seems behind, the first suspect is the MLB web API.

Help and Contributing

If you run into any issues and have steps to reproduce, open an issue. If you have a feature request, open an issue. If you want to contribute a small to medium sized change, open a pull request. If you want to contribute a new feature, open an issue first before opening a PR.

Updating Dependencies

Dependencies requirements are managed using pipreqs. If you are adding or making a change to a dependency (such as updating its version), make sure to update the requirements file with pipreqs:

# If not already installed
pip3 install pipreqs

pipreqs . --force

Licensing

This project as of v1.1.0 uses the GNU Public License. If you intend to sell these, the code must remain open source.

Other Cool Projects

The original version of this board

Inspired by this board, check out the NHL scoreboard ๐Ÿ’

mlb-led-scoreboard's People

Contributors

ajbowler avatar bones-bones avatar breid1313 avatar brentm5 avatar c2mfj avatar dependabot[bot] avatar feram18 avatar jimcreel avatar jmorim avatar joelguth avatar kerzilla avatar mmendelson222 avatar nixon506e avatar peteywhit avatar swemoney avatar thalere avatar tracerrx avatar twfarley avatar ty-porter avatar wardbrian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mlb-led-scoreboard's Issues

Update Install Instructions in README

Wrote up some detailed instructions, from fresh image to finished, to get people going. Use them if you'd like. (not really an issue, just didn't know how else to submit it)


Install MLB LED Scoreboard

Distribution: Raspbian Lite

Enable SSH: Place a file named 'ssh', without any extension, onto the boot partition of the SD card

Connect to raspberry Pi with Putty via SSH

Default user: pi / raspberry

#change password: passwd

Disable snd_bcm2835 (see: https://github.com/hzeller/rpi-rgb-led-matrix#bad-interaction-with-sound)

cd /etc/modprobe.d
sudo nano alsa-blacklist.conf 

Type: blacklist snd_bcm2835
Save: CTRL-O
Hit: enter to overwrite the existing file
Exit nano: CTRL-X

Restart: sudo reboot

Install Dependencies For The LED Matrix

sudo apt-get install python-pip
sudo apt-get install libxml2-dev libxslt-dev

Install Git Command

sudo apt-get install git

Git MLB LED Scoreboard

git clone --recursive https://github.com/ajbowler/mlb-led-scoreboard
cd mlb-led-scoreboard/matrix/bindings/python

Building the RGBMatrix binaries (what controls the LED board)

sudo apt-get update && sudo apt-get install python2.7-dev python-pillow -y
sudo HARDWARE_DESC=adafruit-hat make build-python #If using the Adafruit hat with the flicker mod: adafruit-hat-pwm
sudo HARDWARE_DESC=adafruit-hat make install-python #If using the Adafruit hat with the flicker mod: adafruit-hat-pwm

Demo (Scrolling text: Hello world!)

cd samples
sudo ./runtext.py

Finish up with MLB LED Scoreboard install

cd ../.. #should be in bindings folder now
sudo pip install -e python/
cd ../../ #should be in mlb-led-scoreboard/ now
sudo pip install mlbgame #takes awhile
make

Let's Run It!

sudo python main.py #To stop the script: CTRL-C

To Edit settings

sudo nano config.json.example

Edit the file to how you see fit
Save: CTRL-O
Delete: .example
Confirm: New file
Exit: CTRL-X
#Now when you run 'sudo python main.py' it will display the team, standings, and anything else you have configured

//Thanks to:
//https://github.com/ajbowler/mlb-led-scoreboard
//https://github.com/hzeller/rpi-rgb-led-matrix
//https://learn.adafruit.com/raspberry-pi-rgb-led-matrix-webapp?view=all
//http://www.instructables.com/id/Disable-the-Built-in-Sound-Card-of-Raspberry-Pi/

Center pregame matchup

Center (as best we can, even numbers and all that) the pregame matchup text depending on matrix width.

image

@swemoney has a pretty sweet setup that could use just a little love here.

32x64 board - rows flicker

Rows in the board constantly flicker when running the MLB program. I have not seen the issue running any of the sample programs.

Create Main Menu

This would be the new landing page when you spin up the board. Should have a nice graphic and a menu to navigate to either MLB Standings (see #4) or a list of games to pick from (see #7)

Because this requires a sexy graphic, I'm not gonna do it cause I lack the confidence.

Crash during a network issue

Leaving the scoreboard running for a while, it looks like it's possible for the Pi to run into some kind of strange network hiccup that completely crashes the scoreboard. We should fail more gracefully on this kind of issue.

File "/home/pi/mlb-led-scoreboard/main.py", line 42, in <module>
    GameRenderer(matrix, matrix.CreateFrameCanvas(), games, config).render()
  File "/home/pi/mlb-led-scoreboard/renderers/games.py", line 65, in render
    overview = mlbgame.overview(game.game_id)
  File "/usr/local/lib/python2.7/dist-packages/mlbgame/__init__.py", line 198, in overview
    return mlbgame.game.Overview(mlbgame.game.overview(game_id))
  File "/usr/local/lib/python2.7/dist-packages/mlbgame/game.py", line 324, in overview
    data = mlbgame.data.get_overview(game_id)
  File "/usr/local/lib/python2.7/dist-packages/mlbgame/data.py", line 82, in get_overview
    'linescore.xml'))
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1228, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1198, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

Tampa Bay's too bright

The Rays color scheme isn't working, the really light blue and the white ain't gonna fly.

Need to test some different colors out from their palette, might have to use a dark font.

Home mercy wins showing bottom of the ninth

If the home team won by mercy rule the board is still rendering the bottom of the 9th instead of the final at-bat of the top.

This is going to be fixed by #8 but I'm logging this cause it is a bug and should be tracked.

Pitcher/batter number for each team

Would it be possible to include the jersey number of the pitcher and batter for each team? If you're only using a single 32x32 matrix then there's not enough room for the pitcher and hitter. But if it was possible to put the jersey number or the pitcher and hitter at the end of the team's color block (far right behind the score) then it would still be visible who was up and who was pitching. Similar to how some ballparks do the out of town scoreboard

Crash on postponed games

We don't handle postponed games at all. The Cubs game on 5/20/2017 was postponed. Innings is an empty string so it's not processed very well.

Add option to display standings on an off day

Can we embed division standings as an option for off days? Example move of:

standings = mlbgame.standings(datetime.datetime(year, month, day))
division = next(division for division in standings.divisions if division.name == config.preferred_division)
renderers.standings.render(matrix, matrix.CreateFrameCanvas(), division)

to the branch logic of:

if not len(games):

from main.py.

Store matrix colors off somewhere

Magic numbers galore in here, all for the various RGB values I'm setting for text colors and other goodies.

Need to store these off somewhere so everything's easier to deal with.

Add rotation_rate option for games in progress

Currently we rotate games in progress every 15 seconds, and it would be an easy feature if that duration could be configured via config.json

  • Add rotation_rate to config.json.example that uses the number provided (in seconds) for rotating games.
  • Throw an error and exit gracefully if the rotation rate isn't a number or is less than 1 second. Less than a second would probably bottleneck the board pretty hard.
  • Update the GameRenderer to use the provided refresh_rate and default back to 15 seconds if it isn't provided. Additional code will need to be added to reset the rotation clock to the new start time, similar to how refresh_rate is reset after rotating.
  • Keep pregames on screen for 15 seconds, only implement this for games in progress (right now that means "not PREGAME"). #30 is logged for pregame refresh rates, and those will not be configurable by the user.
  • Update the README documenting the new config option

Add option for end of day

Right now, we get the current day based on the current time. An option that could be set to a time before switching to the next day so the scoreboard, after midnight, still rotates through scores from the previous day.

Create Settings Menu

As more features come into play we'll want a settings menu.

Create a settings menu that can be accessed via main menu (#6) and port all scoreboard related command line args to it, then remove the command line args.

The rpi-rgb-led-matrix command line args will stay as command line args.

Handle non-MLB team banners

For early spring training games, sometimes a team will play a college team. Luckily mlbgame already brings back data, but we currently don't handle teams without colors in colors.json.

Let's just not fill in their banner and fall back to the fill color (dark blue/purple)

Display full standings

Currently the 32x32 has to swap wins and losses being rendered due to the small real estate.

64x32 should be able to show wins and losses at a minimum.

Board crashes during inning breaks

Traceback (most recent call last):
  File "main.py", line 44, in <module>
    GameRenderer(matrix, canvas, games[0], config).render()
  File "/home/pi/shared/mlb-led-scoreboard/renderers/games.py", line 64, in render
    self.__refresh_game(game, overview.status)
  File "/home/pi/shared/mlb-led-scoreboard/renderers/games.py", line 97, in __refresh_game
    scoreboard = Scoreboard(game)
  File "/home/pi/shared/mlb-led-scoreboard/data/scoreboard.py", line 16, in __init__
    self.game_data = self.__current_game_data(game)
  File "/home/pi/shared/mlb-led-scoreboard/data/scoreboard.py", line 27, in __current_game_data
    game_data['inning'] = self.__current_inning(game_id)
  File "/home/pi/shared/mlb-led-scoreboard/data/scoreboard.py", line 44, in __current_inning
    inning_status['at_bat'] = self.__current_at_bat(at_bats[-1])
IndexError: list index out of range
pi@raspberrypi:~/shared/mlb-led-scoreboard $ sudo python main.py
> /home/pi/shared/mlb-led-scoreboard/data/scoreboard.py(44)__current_inning()
-> inning_status['bottom'] = is_bottom
(Pdb) at_bats
[]
(Pdb) inning_status
{'number': 2}

Some fast reaction time and a quick breakpoint before the next inning started determined that a new inning is created but there are no at bats, causing an index error. Need to display "END #" where the number is the previous inning. If inning - 1 is 0, then see #49 as both will be handled in a similar fashion.

64x32 enhancements

Logging this issue to see if there's any interest. I'll keep it open throughout the season and if nothing happens I'll close this, otherwise, anybody interested in this project can throw out some ideas.

Current ideas:

Display pitcher vs. batter info on the second board, including ERA, avg/obp/ops, etc.
Display flashing marquees similar to MLB's GameDay, such as "HOME RUN!"

Add Alexa device support

This is based on a hypothetical that I would enjoy in terms of functionality. I currently have Alexa dev accounts and have built skills. It'd be nice to be able to say "Alexa, turn on the scoreboard" and the scoreboard turns on.

I realize there's a number of challenges associated with this issue, but it's a good opportunity for us to implement this feature. This is low on the totem pole for now.

Consume MLBGame v3

Work is underway to upgrade mlbgame to use the new MLB Stats API instead of the existing XML files. Once this is done, the scoreboard will need to consume the new changes.

Display MLB Standings

Provide a way to display MLB standings. Ideally this would be launched from a menu of sorts (see #6) but for now passing a separate command line flag is good.

I would also accept passing in a flag for the division to display.

Pick game from games list

Display list of current games with the team names, color banners, and scores and provide a way through keyboard nav to pick a game.

If #6 isn't done yet, it's fine to use a command line flag to get to it.

Configure Time Zones

MLB returns everything in Eastern, use the local system clock to convert the game time to local time.

Board crashes during warmup phase

A game is marked by MLB as "In Progress" but there are 0 atbats, causing an index out of bounds error when trying to create the scoreboard.

Traceback (most recent call last):
  File "main.py", line 44, in <module>
    GameRenderer(matrix, canvas, games[0], config).render()
  File "/home/pi/shared/mlb-led-scoreboard/renderers/games.py", line 64, in render
    self.__refresh_game(game, overview.status)
  File "/home/pi/shared/mlb-led-scoreboard/renderers/games.py", line 97, in __refresh_game
    scoreboard = Scoreboard(game)
  File "/home/pi/shared/mlb-led-scoreboard/data/scoreboard.py", line 16, in __init__
    self.game_data = self.__current_game_data(game)
  File "/home/pi/shared/mlb-led-scoreboard/data/scoreboard.py", line 27, in __current_game_data
    game_data['inning'] = self.__current_inning(game_id)
  File "/home/pi/shared/mlb-led-scoreboard/data/scoreboard.py", line 44, in __current_inning
    inning_status['at_bat'] = self.__current_at_bat(at_bats[-1])
IndexError: list index out of range

Need to display something during warmup. Probably just the team banners then instead of the bases and pitches, show "WARMUP"

Display flashing marquee for strikeouts

On the second board, when a player strikes out, flash "STRIKEOUT". The board should barely have enough room for a word that large. If it looks ugly, just "K" might be good enough.

Launch script from a different directory?

I was trying to add the python script to launch on boot but it doesn't work unless I'm in the mlb-led directory. For example:

$ sudo python ~/mlb-led-scoreboard/main.py -r

Traceback (most recent call last):
File "/home/pi/mlb-led-scoreboard/main.py", line 33, in
render_games(matrix, canvas, games[0], args)
File "/home/pi/mlb-led-scoreboard/renderer.py", line 30, in render_games
success = __refresh_scoreboard(canvas, game)
File "/home/pi/mlb-led-scoreboard/renderer.py", line 89, in __refresh_scoreboard
renderer = ScoreboardRenderer(canvas, scoreboard)
File "/home/pi/mlb-led-scoreboard/scoreboard_renderer.py", line 9, in init
self.colors = json.load(open('Assets/colors.json'))
IOError: [Errno 2] No such file or directory: 'Assets/colors.json'

Use argparse

Once the command line arguments get fleshed out, use argparse.

Until that happens I'm just gonna read sysargv

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.