Skip to content

Commit

Permalink
add pro bowl support
Browse files Browse the repository at this point in the history
Pro Bowl Fix: Update __init__.py for team & opponent records & colors

Merge pull request #11 from gonzotek/patch-1
  • Loading branch information
zacs authored Feb 6, 2022
2 parents e6d683b + 8d8f53f commit 2bef65d
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions custom_components/nfl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,20 +219,38 @@ async def async_get_state(config) -> dict:
values["team_abbr"] = event["competitions"][0]["competitors"][team_index]["team"]["abbreviation"]
values["team_id"] = event["competitions"][0]["competitors"][team_index]["team"]["id"]
values["team_name"] = event["competitions"][0]["competitors"][team_index]["team"]["shortDisplayName"]
values["team_record"] = event["competitions"][0]["competitors"][team_index]["records"][0]["summary"]
try:
values["team_record"] = event["competitions"][0]["competitors"][team_index]["records"][0]["summary"]
except:
values["team_record"] = None
values["team_homeaway"] = event["competitions"][0]["competitors"][team_index]["homeAway"]
values["team_logo"] = event["competitions"][0]["competitors"][team_index]["team"]["logo"]
values["team_colors"] = [''.join(('#',event["competitions"][0]["competitors"][team_index]["team"]["color"])),
try:
values["team_colors"] = [''.join(('#',event["competitions"][0]["competitors"][team_index]["team"]["color"])),
''.join(('#',event["competitions"][0]["competitors"][team_index]["team"]["alternateColor"]))]
except:
if team_id == 'NFC':
values["team_colors"] = ['#013369','#013369']
if team_id == 'AFC':
values["team_colors"] = ['#D50A0A','#D50A0A']
values["team_score"] = event["competitions"][0]["competitors"][team_index]["score"]
values["opponent_abbr"] = event["competitions"][0]["competitors"][oppo_index]["team"]["abbreviation"]
values["opponent_id"] = event["competitions"][0]["competitors"][oppo_index]["team"]["id"]
values["opponent_name"] = event["competitions"][0]["competitors"][oppo_index]["team"]["shortDisplayName"]
values["opponent_record"] = event["competitions"][0]["competitors"][oppo_index]["records"][0]["summary"]
try:
values["opponent_record"] = event["competitions"][0]["competitors"][oppo_index]["records"][0]["summary"]
except:
values["opponent_record"] = None
values["opponent_homeaway"] = event["competitions"][0]["competitors"][oppo_index]["homeAway"]
values["opponent_logo"] = event["competitions"][0]["competitors"][oppo_index]["team"]["logo"]
values["opponent_colors"] = [''.join(('#',event["competitions"][0]["competitors"][oppo_index]["team"]["color"])),
''.join(('#',event["competitions"][0]["competitors"][oppo_index]["team"]["alternateColor"]))]
try:
values["opponent_colors"] = [''.join(('#',event["competitions"][0]["competitors"][team_index]["team"]["color"])),
''.join(('#',event["competitions"][0]["competitors"][team_index]["team"]["alternateColor"]))]
except:
if team_id == 'AFC':
values["opponent_colors"] = ['#013369','#013369']
if team_id == 'NFC':
values["opponent_colors"] = ['#D50A0A','#D50A0A']
values["opponent_score"] = event["competitions"][0]["competitors"][oppo_index]["score"]
values["last_update"] = arrow.now().format(arrow.FORMAT_W3C)
values["private_fast_refresh"] = False
Expand Down Expand Up @@ -318,4 +336,4 @@ async def async_clear_states(config) -> dict:
"private_fast_refresh": False
}

return values
return values

0 comments on commit 2bef65d

Please sign in to comment.