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

Release v8.0.1 #527

Merged
merged 5 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 30 additions & 21 deletions data/scoreboard/postgame.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,50 @@
from data.game import Game
import debug

PITCHER_UNKNOWN = "Unknown"


class Postgame:
def __init__(self, game: Game):

winner_side = game.winning_team()
self.winning_pitcher = PITCHER_UNKNOWN
self.winning_pitcher_wins = 0
self.winning_pitcher_losses = 0

winner = game.decision_pitcher_id("winner")
if winner is not None:
self.winning_pitcher = game.full_name(winner)
self.winning_pitcher_wins = game.pitcher_stat(winner, "wins", winner_side)
self.winning_pitcher_losses = game.pitcher_stat(winner, "losses", winner_side)
else:
self.winning_pitcher = PITCHER_UNKNOWN
self.winning_pitcher_wins = 0
self.winning_pitcher_losses = 0
try:
winner_side = game.winning_team()
self.winning_pitcher = game.full_name(winner)
self.winning_pitcher_wins = game.pitcher_stat(winner, "wins", winner_side)
self.winning_pitcher_losses = game.pitcher_stat(winner, "losses", winner_side)
except:
debug.exception("Error getting winning pitcher stats")

self.save_pitcher = None
self.save_pitcher_saves = None

save = game.decision_pitcher_id("save")
if save is not None:
self.save_pitcher = game.full_name(save)
self.save_pitcher_saves = game.pitcher_stat(save, "saves", winner_side)
else:
self.save_pitcher = None
self.save_pitcher_saves = None
try:
self.save_pitcher = game.full_name(save)
self.save_pitcher_saves = game.pitcher_stat(save, "saves", winner_side)
except:
debug.exception("Error getting save pitcher stats")

self.losing_pitcher = PITCHER_UNKNOWN
self.losing_pitcher_wins = 0
self.losing_pitcher_losses = 0
loser = game.decision_pitcher_id("loser")
if loser is not None:
loser_side = game.losing_team()
self.losing_pitcher = game.full_name(loser)
self.losing_pitcher_wins = game.pitcher_stat(loser, "wins", loser_side)
self.losing_pitcher_losses = game.pitcher_stat(loser, "losses", loser_side)
else:
self.losing_pitcher = PITCHER_UNKNOWN
self.losing_pitcher_wins = 0
self.losing_pitcher_losses = 0
try:
loser_side = game.losing_team()
self.losing_pitcher = game.full_name(loser)
self.losing_pitcher_wins = game.pitcher_stat(loser, "wins", loser_side)
self.losing_pitcher_losses = game.pitcher_stat(loser, "losses", loser_side)
except:
debug.exception("Error getting losing pitcher stats")


self.series_status = game.series_status()

Expand Down
36 changes: 20 additions & 16 deletions data/scoreboard/pregame.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import tzlocal

import debug
from data.game import Game
from data.time_formats import TIME_FORMAT_12H

Expand All @@ -20,26 +20,30 @@ def __init__(self, game: Game, time_format):

self.status = game.status()

self.away_starter = PITCHER_TBD
away_id = game.probable_pitcher_id("away")
if away_id is not None:
name = game.full_name(away_id)
wins = game.pitcher_stat(away_id, "wins", "away")
losses = game.pitcher_stat(away_id, "losses", "away")
era = game.pitcher_stat(away_id, "era", "away")
self.away_starter = "{} ({}-{} {} ERA)".format(name, wins, losses, era)
else:
self.away_starter = PITCHER_TBD
try:
name = game.full_name(away_id)
wins = game.pitcher_stat(away_id, "wins", "away")
losses = game.pitcher_stat(away_id, "losses", "away")
era = game.pitcher_stat(away_id, "era", "away")
self.away_starter = "{} ({}-{} {} ERA)".format(name, wins, losses, era)
except:
debug.exception("Error getting away starter stats")

self.home_starter = PITCHER_TBD
home_id = game.probable_pitcher_id("home")
if home_id is not None:
name = game.full_name(home_id)
wins = game.pitcher_stat(home_id, "wins", "home")
losses = game.pitcher_stat(home_id, "losses", "home")
era = game.pitcher_stat(home_id, "era", "home")
self.home_starter = "{} ({}-{} {} ERA)".format(name, wins, losses, era)
else:
self.home_starter = PITCHER_TBD

try:
name = game.full_name(home_id)
wins = game.pitcher_stat(home_id, "wins", "home")
losses = game.pitcher_stat(home_id, "losses", "home")
era = game.pitcher_stat(home_id, "era", "home")
self.home_starter = "{} ({}-{} {} ERA)".format(name, wins, losses, era)
except:
debug.exception("Error getting away starter stats")

self.national_broadcasts = game.broadcasts()
self.series_status = game.series_status()

Expand Down
13 changes: 13 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,19 @@ if [ "$SKIP_MATRIX" = false ]; then
sudo make install-python PYTHON="$PYTHON"

cd ../..

echo "------------------------------------"
echo " Checking for snd_bcm2835"
echo "------------------------------------"
if [ -f /etc/modprobe.d/blacklist-rgbmatrix.conf ]; then
echo "Sound Blacklist File not found, Creating."
echo "blacklist snd_bcm2835" | sudo tee /etc/modprobe.d/blacklist-rgbmatrix.conf
sudo modprobe -r snd_bcm2835
sudo depmod -a
else
echo "Sound Blacklist File found, skipping creation."
fi

fi

if [ "$SKIP_CONFIG" = true ]; then
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SCRIPT_NAME = "MLB LED Scoreboard"
SCRIPT_VERSION = "8.0.0"
SCRIPT_VERSION = "8.0.1"


if __name__ == "__main__":
Expand Down
Loading