Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2bef65d

Browse files
authored
add pro bowl support
Pro Bowl Fix: Update __init__.py for team & opponent records & colorsMerge pull request#11 from gonzotek/patch-1
2 parentse6d683b +8d8f53f commit2bef65d

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

‎custom_components/nfl/__init__.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,20 +219,38 @@ async def async_get_state(config) -> dict:
219219
values["team_abbr"]=event["competitions"][0]["competitors"][team_index]["team"]["abbreviation"]
220220
values["team_id"]=event["competitions"][0]["competitors"][team_index]["team"]["id"]
221221
values["team_name"]=event["competitions"][0]["competitors"][team_index]["team"]["shortDisplayName"]
222-
values["team_record"]=event["competitions"][0]["competitors"][team_index]["records"][0]["summary"]
222+
try:
223+
values["team_record"]=event["competitions"][0]["competitors"][team_index]["records"][0]["summary"]
224+
except:
225+
values["team_record"]=None
223226
values["team_homeaway"]=event["competitions"][0]["competitors"][team_index]["homeAway"]
224227
values["team_logo"]=event["competitions"][0]["competitors"][team_index]["team"]["logo"]
225-
values["team_colors"]= [''.join(('#',event["competitions"][0]["competitors"][team_index]["team"]["color"])),
228+
try:
229+
values["team_colors"]= [''.join(('#',event["competitions"][0]["competitors"][team_index]["team"]["color"])),
226230
''.join(('#',event["competitions"][0]["competitors"][team_index]["team"]["alternateColor"]))]
231+
except:
232+
ifteam_id=='NFC':
233+
values["team_colors"]= ['#013369','#013369']
234+
ifteam_id=='AFC':
235+
values["team_colors"]= ['#D50A0A','#D50A0A']
227236
values["team_score"]=event["competitions"][0]["competitors"][team_index]["score"]
228237
values["opponent_abbr"]=event["competitions"][0]["competitors"][oppo_index]["team"]["abbreviation"]
229238
values["opponent_id"]=event["competitions"][0]["competitors"][oppo_index]["team"]["id"]
230239
values["opponent_name"]=event["competitions"][0]["competitors"][oppo_index]["team"]["shortDisplayName"]
231-
values["opponent_record"]=event["competitions"][0]["competitors"][oppo_index]["records"][0]["summary"]
240+
try:
241+
values["opponent_record"]=event["competitions"][0]["competitors"][oppo_index]["records"][0]["summary"]
242+
except:
243+
values["opponent_record"]=None
232244
values["opponent_homeaway"]=event["competitions"][0]["competitors"][oppo_index]["homeAway"]
233245
values["opponent_logo"]=event["competitions"][0]["competitors"][oppo_index]["team"]["logo"]
234-
values["opponent_colors"]= [''.join(('#',event["competitions"][0]["competitors"][oppo_index]["team"]["color"])),
235-
''.join(('#',event["competitions"][0]["competitors"][oppo_index]["team"]["alternateColor"]))]
246+
try:
247+
values["opponent_colors"]= [''.join(('#',event["competitions"][0]["competitors"][team_index]["team"]["color"])),
248+
''.join(('#',event["competitions"][0]["competitors"][team_index]["team"]["alternateColor"]))]
249+
except:
250+
ifteam_id=='AFC':
251+
values["opponent_colors"]= ['#013369','#013369']
252+
ifteam_id=='NFC':
253+
values["opponent_colors"]= ['#D50A0A','#D50A0A']
236254
values["opponent_score"]=event["competitions"][0]["competitors"][oppo_index]["score"]
237255
values["last_update"]=arrow.now().format(arrow.FORMAT_W3C)
238256
values["private_fast_refresh"]=False
@@ -318,4 +336,4 @@ async def async_clear_states(config) -> dict:
318336
"private_fast_refresh":False
319337
}
320338

321-
returnvalues
339+
returnvalues

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp