Skip to content

Commit

Permalink
v0.5.3 Release Candidate (#29)
Browse files Browse the repository at this point in the history
- Native support for AFL (Australian Football League)
- Defect fix for some previously unsupported locales such as es-419
  • Loading branch information
vasqued2 authored Nov 20, 2022
1 parent 9fc0be0 commit e889e26
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@ This integration is a fork of the excellent [ha-nfl](https://github.com/zacs/ha-
- Compatibility is not guaranteed across different MAJOR or MINOR version numbers.

## Supported Sports / Leagues
- Australian Football - AFL (beta)
- Baseball - MLB
- Basketball - NBA, WNBA, NCAAM, NCAAW, WNBA
- Football - NFL, NCAAF
- Golf - PGA (beta)
- Golf - PGA
- Hockey - NHL
- MMA - UFC (beta)
- MMA - UFC
- U.S. Soccer - MLS, NWSL
- International Soccer - BUND (German Bundesliga), CL (Champions League), EPL (English Premiere League), LIGA (Spanish LaLiga), LIG1 (French Ligue 1), SERA (Italian Serie A), WC (World Cup)
- Racing - F1, IRL (beta)
- Tennis - ATP, WTA (beta)
- Racing - F1, IRL
- Tennis - ATP, WTA
- Volleyball - NCAAVB, NCAAVBW

See Custom API Configuration section below on how to set up additional sports/leagues if you know the ESPN API.
Expand Down
8 changes: 7 additions & 1 deletion custom_components/teamtracker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,13 @@ async def async_get_universal_event_attributes(event, team_index, oppo_index, la
new_values["state"] = event["status"]["type"]["state"].upper()
new_values["event_name"] = event["shortName"]
new_values["date"] = event["date"]
new_values["kickoff_in"] = arrow.get(event["date"]).humanize(locale=lang)
try:
new_values["kickoff_in"] = arrow.get(event["date"]).humanize(locale=lang)
except:
try:
new_values["kickoff_in"] = arrow.get(event["date"]).humanize(locale=lang[:2])
except:
new_values["kickoff_in"] = arrow.get(event["date"]).humanize()
try:
new_values["venue"] = event["competitions"][0]["venue"]["fullName"]
except:
Expand Down
5 changes: 4 additions & 1 deletion custom_components/teamtracker/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15"

LEAGUE_LIST = [
["AFL", "australian-football", "afl"],
["MLB", "baseball", "mlb"],
["NBA", "basketball", "nba"],
["WNBA", "basketball", "wnba"],
Expand All @@ -16,6 +17,7 @@
["UFC", "mma", "ufc"],
["F1", "racing", "f1"],
["IRL", "racing", "irl"],
["NASCAR", "racing", "nascar-premier"],
["BUND", "soccer", "ger.1"],
["CL", "soccer", "uefa.champions"],
["EPL", "soccer", "eng.1"],
Expand All @@ -32,6 +34,7 @@
]

SPORT_LIST = [
["australian-football", "mdi:football-australian"],
["baseball", "mdi:baseball"],
["basketball", "mdi:basketball"],
["football", "mdi:football"],
Expand Down Expand Up @@ -65,7 +68,7 @@

# Misc
TEAM_ID = ""
VERSION = "v0.5.2"
VERSION = "v0.5.3"
ISSUE_URL = "https://github.com/vasqued2/ha-teamtracker"
DOMAIN = "teamtracker"
PLATFORM = "sensor"
Expand Down
8 changes: 7 additions & 1 deletion custom_components/teamtracker/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,13 @@ async def async_set_values(old_values, event, competition, competitor, lang, ind
new_values["date"] = competition["date"]
except:
new_values["date"] = event["date"]
new_values["kickoff_in"] = arrow.get(new_values["date"]).humanize(locale=lang)
try:
new_values["kickoff_in"] = arrow.get(new_values["date"]).humanize(locale=lang)
except:
try:
new_values["kickoff_in"] = arrow.get(new_values["date"]).humanize(locale=lang[:2])
except:
new_values["kickoff_in"] = arrow.get(new_values["date"]).humanize()

try:
new_values["venue"] = competition["venue"]["fullName"]
Expand Down

0 comments on commit e889e26

Please sign in to comment.