Skip to content

Commit 7684324

Browse files
authored
Merge pull request #757 from MLB-LED-Scoreboard/dev
Release v9.1.4
2 parents fe5f947 + 4f8e11b commit 7684324

14 files changed

Lines changed: 44 additions & 37 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ If you'd like to see support for another set of board dimensions, or have design
3636
- [Features](#features)
3737
* [Live Games](#live-games)
3838
* [Pregame](#pregame)
39+
* [Editorial Blurbs](#editorial-blurbs)
3940
* [Division Standings](#division-standings)
4041
- [Installation](#installation)
4142
* [Hardware Assembly](#hardware-assembly)
@@ -98,6 +99,15 @@ If a game hasn't started yet, a pregame screen will be displayed with the probab
9899
<a href="assets/img/128x64.png">
99100
<img alt="Astros-Athletics pregame" width="auto" height="200" src="assets/img/128x64.png"></a>
100101

102+
### Editorial Blurbs
103+
The scoreboard pulls the MLB.com editorial blurb (`headline — subhead`) from the `game_content` endpoint and appends it to the scrolling text on the pregame and postgame screens.
104+
105+
**Recap** blurbs appear on Final games and are usually published within ~30 minutes of the last out — most games get one.
106+
107+
**Preview** blurbs are wired up the same way, but MLB only rarely publishes editorial previews for regular-season games. Expect them mostly on playoff or nationally-broadcast matchups; the feature stays silent the rest of the time.
108+
109+
The behavior can be turned off by setting `editorial_blurb` to `false` in your `config.json`.
110+
101111
### Division Standings
102112
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.
103113

@@ -289,6 +299,7 @@ See [`config.schema.json`](config.schema.json) for a schema for configuration fi
289299
"scrolling_speed" Integer Sets how fast the scrolling text scrolls. Supports an integer between 0 and 6.
290300
"sync_delay_seconds" Integer Delays game updates to sychronize with broadcasts. May introduce delay before rendering live games. Must be at least 0, defaults to 0 (no delay).
291301
"api_refresh_rate" Integer Refresh the game data from the MLB API every X seconds. Must be at least 3, default is 10.
302+
"editorial_blurb" Bool Append the MLB.com editorial blurb (headline + subhead) to the scrolling text on pregame and postgame screens. Recaps are routinely published; previews are rare. See the Editorial Blurbs feature section.
292303
"debug" Bool Game and other debug data is written to your console.
293304
"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.
294305
```

data/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ def refresh_plugin(self, name: str) -> None:
3434
status = UpdateStatus.FAIL
3535
try:
3636
status = plugin.update()
37-
except KeyboardInterrupt as e:
38-
raise e
39-
except:
37+
except Exception:
4038
LOGGER.exception("Failure while updating plugin %s", name)
4139

4240
self.__process_network_status(status)

data/config/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def check_rotate_rates(self):
151151
# Try and cast whatever the user passed into a float
152152
rate = float(value)
153153
self.rotation_rates[key] = rate
154-
except:
154+
except Exception:
155155
# Use the default rotate rate if it fails
156156
LOGGER.warning(
157157
'Unable to convert rotate_rates["{}"] to a Float. Using default value. ({})'.format(

data/config/layout.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ def font(self, keypath):
4747
"""
4848
try:
4949
return self.__get_font_object(self.coords(keypath)[FONTNAME_KEY])
50-
except KeyboardInterrupt as e:
51-
raise e
52-
except:
50+
except Exception:
5351
return self.__get_font_object(self.default_font_name)
5452

5553
def coords(self, keypath):

data/game.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def update(self, force=False, testing_params={}) -> UpdateStatus:
9090
self._status = next(
9191
g["games"][0]["status"] for g in scheduled["dates"] if g["date"] == self.date
9292
)
93-
except:
93+
except Exception:
9494
LOGGER.error("Failed to get game status from schedule")
9595
else:
9696
self._status = self._current_data["gameData"]["status"]
@@ -99,7 +99,7 @@ def update(self, force=False, testing_params={}) -> UpdateStatus:
9999
self._blurb_data.update()
100100
self.print_game_data_debug()
101101
return UpdateStatus.SUCCESS
102-
except:
102+
except Exception:
103103
LOGGER.exception("Networking Error while refreshing the current game data.")
104104
return UpdateStatus.FAIL
105105
return UpdateStatus.DEFERRED
@@ -246,54 +246,54 @@ def pitcher_stat(self, player, stat, team=None):
246246
stats = self._current_data["liveData"]["boxscore"]["teams"]["home"]["players"][ID]["seasonStats"][
247247
"pitching"
248248
]
249-
except:
249+
except Exception:
250250
try:
251251
stats = self._current_data["liveData"]["boxscore"]["teams"]["away"]["players"][ID]["seasonStats"][
252252
"pitching"
253253
]
254-
except:
254+
except Exception:
255255
return ""
256256

257257
return stats[stat]
258258

259259
def probable_pitcher_id(self, team):
260260
try:
261261
return self._current_data["gameData"]["probablePitchers"][team]["id"]
262-
except:
262+
except Exception:
263263
return None
264264

265265
def decision_pitcher_id(self, decision):
266266
try:
267267
return self._current_data["liveData"]["decisions"][decision]["id"]
268-
except:
268+
except Exception:
269269
return None
270270

271271
def batter(self):
272272
try:
273273
batter_id = self._current_data["liveData"]["linescore"]["offense"]["batter"]["id"]
274274
return self.boxscore_name(batter_id)
275-
except:
275+
except Exception:
276276
return ""
277277

278278
def in_hole(self):
279279
try:
280280
batter_id = self._current_data["liveData"]["linescore"]["offense"]["inHole"]["id"]
281281
return self.boxscore_name(batter_id)
282-
except:
282+
except Exception:
283283
return ""
284284

285285
def on_deck(self):
286286
try:
287287
batter_id = self._current_data["liveData"]["linescore"]["offense"]["onDeck"]["id"]
288288
return self.boxscore_name(batter_id)
289-
except:
289+
except Exception:
290290
return ""
291291

292292
def pitcher(self):
293293
try:
294294
pitcher_id = self._current_data["liveData"]["linescore"]["defense"]["pitcher"]["id"]
295295
return self.boxscore_name(pitcher_id)
296-
except:
296+
except Exception:
297297
return ""
298298

299299
def balls(self):
@@ -314,7 +314,7 @@ def last_pitch(self):
314314
play["details"]["type"]["code"],
315315
play["details"]["type"]["description"],
316316
)
317-
except:
317+
except Exception:
318318
return None
319319

320320
def current_pitcher_pitch_count(self):
@@ -325,26 +325,26 @@ def current_pitcher_pitch_count(self):
325325
return self._current_data["liveData"]["boxscore"]["teams"]["away"]["players"][ID]["stats"]["pitching"][
326326
"numberOfPitches"
327327
]
328-
except:
328+
except Exception:
329329
return self._current_data["liveData"]["boxscore"]["teams"]["home"]["players"][ID]["stats"]["pitching"][
330330
"numberOfPitches"
331331
]
332-
except:
332+
except Exception:
333333
return 0
334334

335335
def note(self):
336336
try:
337337
return self._current_data["liveData"]["linescore"]["note"]
338-
except:
338+
except Exception:
339339
return None
340340

341341
def reason(self):
342342
try:
343343
return self._status["reason"]
344-
except:
344+
except Exception:
345345
try:
346346
return self._status["detailedState"].split(":")[1].strip()
347-
except:
347+
except Exception:
348348
return None
349349

350350
def broadcasts(self):

data/schedule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def update(self, force=False) -> UpdateStatus:
3838
try:
3939
# add sportId=51 to additionally get WBC games
4040
all_games = statsapi.schedule(self.date.strftime("%Y-%m-%d"), sportId="1,51")
41-
except:
41+
except Exception:
4242
LOGGER.exception("Networking error while refreshing schedule")
4343
return UpdateStatus.FAIL
4444
else:

data/scoreboard/postgame.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(self, game: "Game"):
2424
self.winning_pitcher = game.full_name(winner)
2525
self.winning_pitcher_wins = game.pitcher_stat(winner, "wins", winner_side)
2626
self.winning_pitcher_losses = game.pitcher_stat(winner, "losses", winner_side)
27-
except:
27+
except Exception:
2828
LOGGER.exception("Error getting winning pitcher stats")
2929

3030
self.save_pitcher = None
@@ -35,7 +35,7 @@ def __init__(self, game: "Game"):
3535
try:
3636
self.save_pitcher = game.full_name(save)
3737
self.save_pitcher_saves = game.pitcher_stat(save, "saves", winner_side)
38-
except:
38+
except Exception:
3939
LOGGER.exception("Error getting save pitcher stats")
4040

4141
self.losing_pitcher = PITCHER_UNKNOWN
@@ -48,7 +48,7 @@ def __init__(self, game: "Game"):
4848
self.losing_pitcher = game.full_name(loser)
4949
self.losing_pitcher_wins = game.pitcher_stat(loser, "wins", loser_side)
5050
self.losing_pitcher_losses = game.pitcher_stat(loser, "losses", loser_side)
51-
except:
51+
except Exception:
5252
LOGGER.exception("Error getting losing pitcher stats")
5353

5454
self.series_status = game.series_status()

data/scoreboard/pregame.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self, game: "Game", time_format):
2020

2121
try:
2222
self.start_time = self.__convert_time(game.datetime())
23-
except:
23+
except Exception:
2424
self.start_time = "TBD"
2525

2626
self.status = game.status()
@@ -34,7 +34,7 @@ def __init__(self, game: "Game", time_format):
3434
losses = game.pitcher_stat(away_id, "losses", "away")
3535
era = game.pitcher_stat(away_id, "era", "away")
3636
self.away_starter = "{} ({}-{} {} ERA)".format(name, wins, losses, era)
37-
except:
37+
except Exception:
3838
LOGGER.exception("Error getting away starter stats")
3939

4040
self.home_starter = PITCHER_TBD
@@ -46,7 +46,7 @@ def __init__(self, game: "Game", time_format):
4646
losses = game.pitcher_stat(home_id, "losses", "home")
4747
era = game.pitcher_stat(home_id, "era", "home")
4848
self.home_starter = "{} ({}-{} {} ERA)".format(name, wins, losses, era)
49-
except:
49+
except Exception:
5050
LOGGER.exception("Error getting away starter stats")
5151

5252
self.national_broadcasts = game.broadcasts()

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def __render_main(matrix, data, plugins):
108108

109109
try:
110110
main(matrix, config)
111-
except:
111+
except Exception:
112112
LOGGER.exception("Untrapped error in main!")
113113
sys.exit(1)
114114
finally:

news/src/mlb_led_scoreboard_news/dates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self, dates, today: date):
1616
if year == now.year and end_date < now:
1717
data_d = statsapi.get("season", {"sportId": 1, "seasonId": year + 1})
1818
self.__parse_important_dates(data_d["seasons"][0], year + 1)
19-
except:
19+
except Exception:
2020
LOGGER.exception("Failed to refresh important dates")
2121
self.important_dates = [{"text": "None", "date": datetime(3000, 1, 1), "max_days": 1}]
2222
try:
@@ -25,7 +25,7 @@ def __init__(self, dates, today: date):
2525
if d.count("-") == 1:
2626
d = f"{year}-{d}"
2727
self.__add_date(d, date["text"], date.get("max_days", 365))
28-
except:
28+
except Exception:
2929
LOGGER.exception("Failed to parse important dates from config")
3030

3131
LOGGER.debug("Important dates: %s", self.important_dates)

0 commit comments

Comments
 (0)