Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c8f535ee48 | |||
| 65369896cc | |||
| 7e41cf4781 | |||
| 20ffd05df1 | |||
| 2e85ced6ce | |||
| 5d65533ff5 | |||
| 085514ab16 | |||
| 960ff6e5ac | |||
| 04e29469dd | |||
| 360188114e |
@@ -6,8 +6,8 @@ SCOREBOARD_DATA_FILE = 'app/data/scoreboard_data.json'
|
||||
|
||||
def get_scoreboard_data():
|
||||
now = datetime.now()
|
||||
start_time_evening = now.replace(hour=23, minute=00, second=0, microsecond=0) # 7:00 PM EST
|
||||
end_time_evening = now.replace(hour=8, minute=00, second=0, microsecond=0) # 3:00 AM EST
|
||||
start_time_evening = now.replace(hour=19, minute=00, second=0, microsecond=0) # 7:00 PM EST
|
||||
end_time_evening = now.replace(hour=3, minute=00, second=0, microsecond=0) # 3:00 AM EST
|
||||
|
||||
if now >= start_time_evening or now < end_time_evening:
|
||||
# Use now URL
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
import sqlite3
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
def process_record(record):
|
||||
if record == "N/A":
|
||||
return "N/A"
|
||||
else:
|
||||
parts = record.split("-")
|
||||
formatted_parts = [part.zfill(2) for part in parts]
|
||||
return "-".join(formatted_parts)
|
||||
|
||||
def extract_game_info(scoreboard_data):
|
||||
if not scoreboard_data:
|
||||
return []
|
||||
@@ -22,8 +30,8 @@ def extract_game_info(scoreboard_data):
|
||||
"Intermission": game["clock"]["inIntermission"] if game_state == "LIVE" else "N/A",
|
||||
"Priority": calculate_game_priority(game),
|
||||
"Start Time": process_start_time(game),
|
||||
"Home Record": game["homeTeam"]["record"] if game["gameState"] in ["PRE", "FUT"] else "N/A",
|
||||
"Away Record": game["awayTeam"]["record"] if game["gameState"] in ["PRE", "FUT"] else "N/A",
|
||||
"Home Record": process_record(game["homeTeam"]["record"]) if game["gameState"] in ["PRE", "FUT"] else "N/A",
|
||||
"Away Record": process_record(game["awayTeam"]["record"]) if game["gameState"] in ["PRE", "FUT"] else "N/A",
|
||||
"Home Shots": game["homeTeam"]["sog"] if game["gameState"] not in ["PRE", "FUT"] else 0,
|
||||
"Away Shots": game["awayTeam"]["sog"] if game["gameState"] not in ["PRE", "FUT"] else 0,
|
||||
"Home Power Play": get_power_play_info(game, game["homeTeam"]["name"]["default"]),
|
||||
@@ -58,7 +66,11 @@ def process_time_remaining(game):
|
||||
def process_start_time(game):
|
||||
if game["gameState"] in ["PRE", "FUT"]:
|
||||
utc_time = game["startTimeUTC"]
|
||||
return utc_to_est_time(utc_time)
|
||||
est_time = utc_to_est_time(utc_time)
|
||||
# Check if the hour starts with a zero
|
||||
if est_time.startswith("0"):
|
||||
est_time = est_time[1:] # Drop the leading zero
|
||||
return est_time
|
||||
else:
|
||||
return "N/A"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user