|
|
|
@@ -1,6 +1,14 @@
|
|
|
|
import sqlite3
|
|
|
|
import sqlite3
|
|
|
|
from datetime import datetime, timedelta
|
|
|
|
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):
|
|
|
|
def extract_game_info(scoreboard_data):
|
|
|
|
if not scoreboard_data:
|
|
|
|
if not scoreboard_data:
|
|
|
|
return []
|
|
|
|
return []
|
|
|
|
@@ -22,8 +30,8 @@ def extract_game_info(scoreboard_data):
|
|
|
|
"Intermission": game["clock"]["inIntermission"] if game_state == "LIVE" else "N/A",
|
|
|
|
"Intermission": game["clock"]["inIntermission"] if game_state == "LIVE" else "N/A",
|
|
|
|
"Priority": calculate_game_priority(game),
|
|
|
|
"Priority": calculate_game_priority(game),
|
|
|
|
"Start Time": process_start_time(game),
|
|
|
|
"Start Time": process_start_time(game),
|
|
|
|
"Home Record": game["homeTeam"]["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": game["awayTeam"]["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,
|
|
|
|
"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,
|
|
|
|
"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"]),
|
|
|
|
"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):
|
|
|
|
def process_start_time(game):
|
|
|
|
if game["gameState"] in ["PRE", "FUT"]:
|
|
|
|
if game["gameState"] in ["PRE", "FUT"]:
|
|
|
|
utc_time = game["startTimeUTC"]
|
|
|
|
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:
|
|
|
|
else:
|
|
|
|
return "N/A"
|
|
|
|
return "N/A"
|
|
|
|
|
|
|
|
|
|
|
|
|