Update live_series_update.py
Add special characters check Add detailed player description
This commit is contained in:
parent
cfdf0e985d
commit
8c2a2f5220
@ -42,7 +42,9 @@ def sanitize_name(start_name: str) -> str:
|
||||
.replace("ñ", "n")
|
||||
.replace("ó", "o")
|
||||
.replace("í", "i")
|
||||
.replace("ú", "u"))
|
||||
.replace("ú", "u")
|
||||
.replace("'", "")
|
||||
.replace('-', ' '))
|
||||
|
||||
|
||||
# class BattingStat(pydantic.BaseModel):
|
||||
@ -102,10 +104,12 @@ async def main(args):
|
||||
season_pct = game_count / 162
|
||||
print(f'Cardset ID: {cardset["id"]} / Season: {season}\nGame count: {game_count} / Season %: {season_pct}\n')
|
||||
|
||||
if season_pct < 1:
|
||||
player_desc_prefix = f'Live'
|
||||
if 'player_description' in arg_data:
|
||||
player_description = arg_data['player_description']
|
||||
elif season_pct < 1:
|
||||
player_description = f'Live'
|
||||
else:
|
||||
player_desc_prefix = f'{season}'
|
||||
player_description = f'{season}'
|
||||
|
||||
start_time = datetime.datetime.now()
|
||||
release_directory = f'{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}'
|
||||
@ -157,7 +161,7 @@ async def main(args):
|
||||
'set_num': int(float(df_data['key_fangraphs'])),
|
||||
'rarity_id': 99,
|
||||
'pos_1': 'DH',
|
||||
'description': f'{player_desc_prefix} {f_name} {l_name}',
|
||||
'description': f'{player_description}',
|
||||
'bbref_id': df_data.name,
|
||||
'fangr_id': int(float(df_data['key_fangraphs']))
|
||||
})
|
||||
@ -421,7 +425,7 @@ async def main(args):
|
||||
5: 10,
|
||||
99: 2400
|
||||
}
|
||||
params = [('description', f'{player_desc_prefix} {df_data["p_name"]}')]
|
||||
params = [('description', f'{player_description}')]
|
||||
|
||||
if release_directory not in df_data['image']:
|
||||
params.extend([('image', f'{CARD_BASE_URL}/{df_data["player_id"]}/battingcard'
|
||||
@ -558,7 +562,7 @@ async def main(args):
|
||||
'set_num': int(float(df_data['key_fangraphs'])),
|
||||
'rarity_id': 99,
|
||||
'pos_1': 'P',
|
||||
'description': f'{player_desc_prefix} {f_name} {l_name}',
|
||||
'description': f'{player_description}',
|
||||
'bbref_id': df_data.name,
|
||||
'fangr_id': int(float(df_data['key_fangraphs']))
|
||||
})
|
||||
@ -741,7 +745,7 @@ async def main(args):
|
||||
5: 10,
|
||||
99: 2400
|
||||
}
|
||||
params = [('description', f'{player_desc_prefix} {df_data["p_name"]}')]
|
||||
params = [('description', f'{player_description}')]
|
||||
|
||||
if release_directory not in df_data['image']:
|
||||
params.extend([('image', f'{CARD_BASE_URL}/{df_data["player_id"]}/pitchingcard'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user