Closed Irishking03 closed 11 months ago
Try sudo python3 main.py. ....
nope that doesn't work either @alexanderthebadatcoding
pi@raspberrypi:~/nfl-led-scoreboard $ sudo python3 main.py --led-gpio-mapping=regular --led-brightness=60 --led-slowdown-gpio=4 --led-rows=32 --led-cols=64
Traceback (most recent call last):
File "/home/pi/nfl-led-scoreboard/main.py", line 6, in
Did your install install the nfl_api_parser? Try pip3 install nfl_api_parser
. Or pip install nfl_api_parser
.
i tried both of those in the nfl-led-scoreboard and get 2 errors. could not find a version that satisfies the requirement nfl_api_parser & ERROR No matching distribution found for nfl_api_parser @pjockey
that file shoudl be located in /home/pi/nfl-led-scoreboard/data/nfl_api_parser.py
Let me see. Also, I think it is a python2 program. I have a non python2 versiono f Raspberry OS on my unit at the moment.
@pjockey yes it's there.
I use python3 for the script but in the "/home/pi/nfl-led-scoreboard/data/data.py" file I edited it to:
import data.nfl_api_parser as nflparser
@alexanderthebadatcoding
/home/pi/nfl-led-scoreboard/data/data.py
from datetime import datetime, timedelta import time as t import nfl_api_parser as nflparser import debug
NETWORK_RETRY_SLEEP_TIME = 10.0
class Data: def init(self, config):
self.config = config
# Flag to determine when to refresh data
self.needs_refresh = True
self.helmet_logos = self.config.helmet_logos
# Parse today's date and see if we should use today or yesterday
self.get_current_date()
# Fetch the teams info
self.refresh_games()
# self.playoffs = nflparser.is_playoffs()
# self.games = nflparser.get_all_games()
# self.game = self.choose_game()
# self.gametime = self.get_gametime()
# What game do we want to start on?
self.current_game_index = 0
self.current_division_index = 0
# self.scores = {}
def get_current_date(self):
return datetime.utcnow()
def refresh_game(self):
self.game = self.choose_game()
self.needs_refresh = False
def refresh_games(self):
attempts_remaining = 5
while attempts_remaining > 0:
try:
all_games = nflparser.get_all_games()
if self.config.rotation_only_preferred:
self.games = self.__filter_list_of_games(all_games, self.config.preferred_teams)
# if rotation is disabled, only look at the first team in the list of preferred teams
elif not self.config.rotation_enabled:
self.games = self.__filter_list_of_games(all_games, [self.config.preferred_teams[0]])
else:
self.games = all_games
self.games_refresh_time = t.time()
self.network_issues = False
break
except Exception as e:
self.network_issues = True
debug.error("Networking error while refreshing the master list of games. {} retries remaining.".format(attempts_remaining))
debug.error("Exception: {}".format(e))
attempts_remaining -= 1
t.sleep(NETWORK_RETRY_SLEEP_TIME)
except ValueError:
self.network_issues = True
debug.error("Value Error while refreshing master list of games. {} retries remaining.".format(attempts_remaining))
debug.error("ValueError: Failed to refresh list of games")
attempts_remaining -= 1
t.sleep(NETWORK_RETRY_SLEEP_TIME)
# # If we run out of retries, just move on to the next game
if attempts_remaining <= 0 and self.config.rotation_enabled:
self.advance_to_next_game()
def get_gametime(self):
tz_diff = t.timezone if (t.localtime().tm_isdst == 0) else t.altzone
gametime = datetime.strptime(self.games[self.current_game_index]['date'], "%Y-%m-%dT%H:%MZ") + timedelta(hours=(tz_diff / 60 / 60 * -1))
return gametime
def current_game(self):
return self.games[self.current_game_index]
# def update_scores(self, homescore, awayscore):
# self.scores[self.current_game_index] = {'home': homescore, 'away': awayscore}
# def get_current_scores(self):
# if self.scores[self.current_game_index]:
# return self.scores[self.current_game_index]
# else:
# return {'home': 0, 'away': 0}
# def refresh_overview(self):
# attempts_remaining = 5
# while attempts_remaining > 0:
# try:
# self.__update_layout_state()
# self.needs_refresh = False
# self.print_overview_debug()
# self.network_issues = False
# break
# except URLError, e:
# self.network_issues = True
# debug.error("Networking Error while refreshing the current overview. {} retries remaining.".format(attempts_remaining))
# debug.error("URLError: {}".format(e.reason))
# attempts_remaining -= 1
# time.sleep(NETWORK_RETRY_SLEEP_TIME)
# except ValueError:
# self.network_issues = True
# debug.error("Value Error while refreshing current overview. {} retries remaining.".format(attempts_remaining))
# debug.error("ValueError: Failed to refresh overview for {}".format(self.current_game().game_id))
# attempts_remaining -= 1
# time.sleep(NETWORK_RETRY_SLEEP_TIME)
# # If we run out of retries, just move on to the next game
# if attempts_remaining <= 0 and self.config.rotation_enabled:
# self.advance_to_next_game()
def advance_to_next_game(self):
self.current_game_index = self.__next_game_index()
return self.current_game()
# def game_index_for_preferred_team(self):
# if self.config.preferred_teams:
# return self.__game_index_for(self.config.preferred_teams[0])
# else:
# return 0
def __filter_list_of_games(self, games, teams):
return list(game for game in games if set([game['awayteam'], game['hometeam']]).intersection(set(teams)))
# def __game_index_for(self, team_name):
# team_index = 0
# print(self.games)
# # team_idxs = [i for i, game in enumerate(self.games) if team_name in [game.awayteam, game.hometeam]]
# for game in enumerate(self.games):
# print(game)
# return team_index
def __next_game_index(self):
counter = self.current_game_index + 1
if counter >= len(self.games):
counter = 0
return counter
#
# Debug info
# def print_overview_debug(self):
# debug.log("Overview Refreshed: {}".format(self.overview.id))
# debug.log("Pre: {}".format(Pregame(self.overview, self.config.time_format)))
# debug.log("Live: {}".format(Scoreboard(self.overview)))
# debug.log("Final: {}".format(Final(self.current_game())))
Try this
@alexanderthebadatcoding
/home/pi/nfl-led-scoreboard/data/data.py
from datetime import datetime, timedelta import time as t import data.nfl_api_parser as nflparser import debug
@alexanderthebadatcoding NEW ERROR NOW..
sudo python main.py --led-gpio-mapping=regular --led-brightness=60 --led-slowdown-gpio=2 --led-rows=32 --led-cols=64Suggestion: to slightly improve display update, add
isolcpus=3
at the end of /boot/cmdline.txt and reboot (see README.md)
INFO (15:07:19): NFL Scoreboard - v1.0.0 (64x32)
something bad? Expecting value: line 1 column 1 (char 0)
something bad? Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/home/pi/nfl-led-scoreboard/main.py", line 30, in
Wait.. IF i remove the led-cols=64 and led-rows=32 my 3 - 32x64 boards light up and each board displays the same image '
NEVERMIND.... I GOT IT Now to play with the renderer files
THANK YOU SO MUCH
yeah, I'm sorry man, this codebase (and the ff one) is a real mess. I've been too busy to fix the various errors that have been happening, super grateful to everyone in the community helping out. I'll do a lot more improvements over the next offseason
@mikemountain nah man your good... Im playing with renders now and adjusting to fit 196x92 board
9 panels, 64x32? Nice.
@pjockey yeah.. Have NHL and MLB on it as well. API is down currently for NHL and I know they are looking for a new setup. But board crashed every night. MLB on the other hand is super sharp. I'm going to Play around with this today and for the next few days. Ill share pictures.
I'm not as familiar with the NHL, but you might be able to copy the code for the NFL scoreboard and just use the ESPN api in the meantime, http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/scoreboard and just change the logos (ie https://a.espncdn.com/i/teamlogos/nhl/500/scoreboard/bos.png)
I was able to do it for MLS, and it's mostly working. Also there is this repo for the NBA https://github.com/m0ranwad/nba-led-scoreboard
@alexanderthebadatcoding you have a picture of the MLS one. Love to see that.. ALSO this is the new error I get. The board shuts down after a little while and now when trying to redo the code I get
~/nfl-led-scoreboard $ sudo python main.py --led-gpio-mapping=regular --led-brightness=60 --led-slowdown-gpio=2 --led-chain=3 --led-parallel=3
Suggestion: to slightly improve display update, add
isolcpus=3
at the end of /boot/cmdline.txt and reboot (see README.md)
INFO (18:09:31): NFL Scoreboard - v1.0.0 (192x96)
Traceback (most recent call last):
File "/home/pi/nfl-led-scoreboard/main.py", line 30, in
I started over again. I think I was doing to much at once. But got it back working
It looks better in person
You should check the troubleshooting section, https://github.com/hzeller/rpi-rgb-led-matrix/#troubleshooting and CPU Usage: https://github.com/hzeller/rpi-rgb-led-matrix/#cpu-use
@alexanderthebadatcoding im good now I am back up and running. I had some of the false and true statements mixed up I think. Also it did not help that I was doing PHI instead of PHL or whatever it was.
@Irishking03 if the NHL api is still down you can try this: https://github.com/alexanderthebadatcoding/nhl-led/
I think I got it working.
Is this a python2 project? During the install, the installer could not find python-pillow. Using Bullseye OS. Lots of errors.
Is this a python2 project? During the install, the installer could not find python-pillow. Using Bullseye OS. Lots of errors.
I don't think so. But it is kind of a mess of different projects combined. So that could be the issue. I need to change the readme. Are you able to run it without installing? Just ’sudo python3 main.py’
I am using the older Buster raspberry pi lite OS, I think I remember seeing somewhere that version is more compatible.
the scrpit runs with sudo python main.py
prior to attempting the ./install.sh. only python3 installed. The script runs, but the screen is giberous. Just a bunch of bluey green leds light up.
I think I changed the settings in the utils.py file, I added the panel type to: default="FM6126A" you should be able to delete that, and see if that helps. also change the gpio-mapping settings, if you're not using the adafruit hat.
(I'll update the code too)
I just installed the nfl board on a new raspberry pi and this is the error I get using this argument in terminal
sudo python main.py --led-gpio-mapping=regular --led-cols=64 --led-rows=32 --led-brightness=60 --led-slowdown-gpio=2
Here is the ERROR:
File "/home/pi/nfl-led-scoreboard/main.py", line 6, in
from data.data import Data
File "/home/pi/nfl-led-scoreboard/data/data.py", line 3, in
import nfl_api_parser as nflparser
ModuleNotFoundError: No module named 'nfl_api_parser'