Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: PGA Tour #2910

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 37 additions & 30 deletions apps/pgatour/pga_tour.star
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ Bug fix - During play, the completed round scores were showing the previous roun
v2.8
Fixed situation that when play is suspended, "state" value = "post" (round is complete) and does not show in progress scores for the suspended round,
Also, updated title bar to show that play is suspended

v2.9
Updated Tournament IDs for 2025 Season
"""

load("encoding/json.star", "json")
Expand All @@ -80,7 +83,7 @@ API2 = "https://site.api.espn.com/apis/site/v2/sports/golf/pga/scoreboard"

CACHE_TTL_SECS = 60
DEFAULT_TIMEZONE = "Australia/Adelaide"
THE_EXCEPTIONS = ["401580329", "401580360"] # The Sentry and The Open
THE_EXCEPTIONS = ["401703489", "401703521"] # The Sentry and The Open

# List will be a work in progress
PLAYER_MAPPING = """
Expand All @@ -100,40 +103,42 @@ PLAYER_MAPPING = """

TOURNAMENT_MAPPING = """
{
"401580332": "Farmers Ins",
"401580333": "AT&T Pro-Am",
"401580335": "Genesis Inv",
"401580338": "Arnold Palm",
"401703491": "The AmEx",
"401703492": "Farmers Ins",
"401703493": "AT&T Pro-Am",
"401703495": "Genesis Inv",
"401703498": "Arnold Palm",
"401580340": "The Players",
"401580347": "Zurich Clas",
"401580346": "Puntacana",
"401580348": "CJ Cup",
"401580341": "Valspar",
"401580342": "Houston Opn",
"401580343": "Texas Open",
"401580344": "The Masters",
"401580345": "Heritage",
"401580353": "Canadian Op",
"401580354": "Memorial",
"401580351": "PGA Champ",
"401703507": "Zurich Clas",
"401703506": "Puntacana",
"401703508": "The CJ Cup",
"401703501": "Valspar",
"401703502": "Houston Opn",
"401703503": "Texas Open",
"401703504": "The Masters",
"401703505": "Heritage",
"401703514": "Canadian Op",
"401703513": "Memorial",
"401703511": "PGA Champ",
"401465538": "Barbasol",
"401580359": "Scottish",
"401580363": "Wyndham",
"401580364": "FedEx St.J",
"401580365": "BMW Champ",
"401703519": "Scottish",
"401703524": "Wyndham",
"401703525": "FedEx St.J",
"401703530": "BMW Champ",
"401558309": "Q-School",
"401634279": "Kentucky",
"401580361": "Barracuda"
"401703520": "ISCO Champ",
"401703522": "Barracuda",
"401703531": "TOUR CHAMP"
}
"""

MAJOR_MAPPING = """
{
"401580340": "#003360",
"401580344": "#006747",
"401580351": "#00205B",
"401580355": "#003865",
"401580360": "#1A1C3C"
"401703500": "#003360",
"401703504": "#006747",
"401703511": "#00205B",
"401703515": "#003865",
"401703521": "#1A1C3C"
}
"""

Expand Down Expand Up @@ -415,6 +420,8 @@ def getPlayerProgress(x, s, t, Title, TitleColor, ColorGradient, stage, state, t
LeaderTeeTime = s[0]["status"]["teeTime"]
LeaderTeeTimeFormat = time.parse_time(LeaderTeeTime, format = "2006-01-02T15:04Z").in_location(timezone)
TimeDiff = LeaderTeeTimeFormat - time.now()

#print(TimeDiff)
if TimeDiff.hours < 12:
ShowTeeTimes = True

Expand Down Expand Up @@ -564,11 +571,11 @@ def getPlayerFontColor(HolesCompleted, ColorGradient):
def OppositeFieldCheck(ID):
# check the ID of the event, and if its a tournament with an opposite field go to the second event in the API
i = 0
if ID == "401580349": # Wells Fargo -> Myrtle Beach
if ID == "401703509": # Truist -> Myrtle Beach
i = 1
elif ID == "401580360": # The Open -> Barracuda
elif ID == "401703521": # The Open -> Barracuda
i = 1
elif ID == "401580359": # Scottish Open -> Kentucky Champ
elif ID == "401703519": # Scottish Open -> ISCO Champ
i = 1
else:
i = 0
Expand Down
Loading