Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d07330891f | |||
| 0412b07f35 | |||
| 2543036ddd | |||
| c0f1be346c | |||
| 1b376b4aa1 | |||
| 941871d766 | |||
| 7cc8913a00 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
/nhle_scoreboard_response.txt
|
||||
/nhle_standings_response.txt
|
||||
/nhl_standings.db
|
||||
12
app.py
12
app.py
@@ -7,6 +7,7 @@ import threading
|
||||
import time
|
||||
import schedule
|
||||
import json
|
||||
from update_nhl_standings_db import update_nhl_standings
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
@@ -39,8 +40,9 @@ def store_scoreboard_data():
|
||||
global scoreboard_data
|
||||
scoreboard_data = get_nhle_scoreboard()
|
||||
|
||||
# Schedule the task to run every 10 seconds
|
||||
def schedule_task():
|
||||
# Schedule tasks
|
||||
def schedule_tasks():
|
||||
schedule.every(300).seconds.do(update_nhl_standings)
|
||||
schedule.every(10).seconds.do(store_scoreboard_data)
|
||||
while True:
|
||||
schedule.run_pending()
|
||||
@@ -157,9 +159,6 @@ def get_game_outcome(game_state, game):
|
||||
|
||||
return last_period_type
|
||||
|
||||
|
||||
|
||||
|
||||
def calculate_game_priority(game):
|
||||
if game["gameState"] in ["FINAL", "OFF", "PRE", "FUT"] or game["clock"]["inIntermission"]:
|
||||
return 0
|
||||
@@ -250,5 +249,6 @@ def get_scoreboard():
|
||||
|
||||
if __name__ == '__main__':
|
||||
store_scoreboard_data()
|
||||
threading.Thread(target=schedule_task).start()
|
||||
update_nhl_standings()
|
||||
threading.Thread(target=schedule_tasks).start()
|
||||
serve(app, host="0.0.0.0", port=2897)
|
||||
BIN
nhl_standings.db
BIN
nhl_standings.db
Binary file not shown.
@@ -72,6 +72,7 @@ function generateGameBoxes(games, state) {
|
||||
html += '<span class="team-power-play">' + game['Home Power Play'] + '</span>';
|
||||
html += '</div>';
|
||||
html += '<span class="team-score">' + game['Home Score'] + '</span>';
|
||||
html += '</div>';
|
||||
html += '<div class="game-info">';
|
||||
if (game['Intermission']) {
|
||||
html += '<div class="live-state-intermission">'
|
||||
@@ -104,7 +105,7 @@ function generateGameBoxes(games, state) {
|
||||
html += '<div class="live-time">' + game['Time Remaining'] + '</div>';
|
||||
}
|
||||
html += '</div>';
|
||||
html += '<div class="game-info>';
|
||||
html += '<div class="game-info">';
|
||||
html += '<strong>Game Score: </strong>' + game['Priority'];
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
||||
@@ -76,9 +76,10 @@ h1 {
|
||||
}
|
||||
|
||||
.game-info {
|
||||
margin-top: 10px;
|
||||
margin-top: 12px;
|
||||
color: #aaa; /* Lighten the text color */
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.game-info strong {
|
||||
@@ -171,7 +172,7 @@ h1 {
|
||||
z-index: 1; /* Ensure the time box is above other content */
|
||||
}
|
||||
|
||||
.live-games-section {
|
||||
#live-games-section {
|
||||
display: flex;
|
||||
align-items: start;
|
||||
flex-wrap: wrap;
|
||||
@@ -179,7 +180,7 @@ h1 {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.pre-games-section {
|
||||
#pre-games-section {
|
||||
display: flex;
|
||||
align-items: start;
|
||||
flex-wrap: wrap;
|
||||
@@ -187,7 +188,7 @@ h1 {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.final-games-section {
|
||||
#final-games-section {
|
||||
display: flex;
|
||||
align-items: start;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -44,6 +44,7 @@ def extract_standings_info():
|
||||
print("Error:", response.status_code)
|
||||
return None
|
||||
|
||||
def update_nhl_standings():
|
||||
# Connect to SQLite database
|
||||
conn = sqlite3.connect("nhl_standings.db")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user