This project is meant to be customized to follow your favorite sports and teams. You can do this by editing the parameters at the top of the code.py file.
Time Zone
The ESPN API stores the timestamp for games in UTC. There is a function in the code that converts the UTC time to your defined time zone. You'll add your time zone UTC offset and time zone name into the timezone_info
array:
# your timezone UTC offset and timezone name timezone_info = [-4, "EDT"]
Sports and Teams
The sport_name
and sport_league
array determine which ESPN API feeds are fetched in the code. You'll add the name of the sport (football, basketball, etc) to the sport_name
array and the corresponding league (NFL, NBA, etc.) to the sport_league
array.
# the name of the sports you want to follow sport_name = ["football", "baseball", "soccer", "hockey", "basketball"] # the name of the corresponding leagues you want to follow sport_league = ["nfl", "mlb", "usa.1", "nhl", "nba"]
You'll add your team names to the team0
thru team4
arrays. You'll include the full name of the team, followed by the team abbreviation. If you aren't sure about your team information, you can open the ESPN API JSON URL in a browser and find your team to see how it is being referred to by the API.
# the team names you want to follow # must match the order of sport/league arrays # include full name and then abbreviation (usually city/region) team0 = ["New England Patriots", "NE"] team1 = ["Toronto Blue Jays", "TOR"] team2 = ["Chicago Fire FC", "CHI"] team3 = ["Los Angeles Kings", "LA"] team4 = ["Minnesota Timberwolves", "MIN"]
Timers
Two timers are used in the code loop. The fetch_timer
determines how often the API is fetched by the Matrix Portal S3. The display_timer
determines the speed at which the matrices scroll thru your different team data.
# how often the API should be fetched fetch_timer = 300 # seconds # how often the display should update display_timer = 60 # seconds
If a game is scheduled for your team, the date and time in your time zone are shown at the bottom of the matrices. Your team is always shown on the left and the opposing team is shown on the right. "HOME" and "AWAY" information are shown below the team logos.
While a game is happening, the score and game details are shown on the matrices. The details will vary depending on the sport.
When a game is completed, the final score is shown along with the text "Final" at the bottom of the matrices.
If your team is not found in the API response, then your team's logo is shown twice on the display along with "NO DATA AVAILABLE" at the bottom of the matrices. This could mean that the team does not have a game currently scheduled according to the JSON response or the league could be in the off-season.
Text editor powered by tinymce.