Migrated args to constants

This commit is contained in:
Cal Corum 2024-11-02 22:50:54 -05:00
parent 863d906657
commit ac544965ae

View File

@ -15,15 +15,20 @@ logging.basicConfig(
)
async def main(args):
arg_data = get_args(args)
CARDSET_NAME = '1998 Live'
START_ID = None # Integer to only start pulling cards at player_id START_ID
TEST_COUNT = None # integer to stop after TEST_COUNT calls
HTML_CARDS = False # boolean to only check and not generate cards
SKIP_ARMS = False
SKIP_BATS = False
cardset_name = arg_data['cardset_name']
print(f'Searching for cardset: {cardset_name}')
c_query = await db_get('cardsets', params=[('name', cardset_name)])
async def main(args):
print(f'Searching for cardset: {CARDSET_NAME}')
c_query = await db_get('cardsets', params=[('name', CARDSET_NAME)])
if c_query['count'] == 0:
print(f'I do not see a cardset named {cardset_name}')
print(f'I do not see a cardset named {CARDSET_NAME}')
return
cardset = c_query['cardsets'][0]
del c_query
@ -44,11 +49,11 @@ async def main(args):
start_time = datetime.datetime.now()
for x in all_players:
if 'pitching' in x['image'] and 'skip_arms' in arg_data and arg_data['skip_arms'].lower() == 'true':
if 'pitching' in x['image'] and SKIP_ARMS:
pass
elif 'batting' in x['image'] and 'skip_bats' in arg_data and arg_data['skip_bats'].lower() == 'true':
elif 'batting' in x['image'] and SKIP_BATS:
pass
elif 'start_id' in arg_data and int(arg_data['start_id']) > x['player_id']:
elif START_ID is not None and START_ID > x['player_id']:
pass
elif 'sombaseball' in x['image']:
errors.append((x, f'Bad card url: {x["image"]}'))
@ -56,11 +61,11 @@ async def main(args):
count += 1
if count % 20 == 0:
print(f'Card #{count + 1} being pulled is {x["p_name"]}...')
elif 'test_count' in arg_data and int(arg_data['test_count']) < count:
elif TEST_COUNT is not None and TEST_COUNT < count:
print(f'Done test run')
break
if 'html_cards' in arg_data and arg_data['html_cards'].lower() == 'true':
if HTML_CARDS:
card_url = f'{x["image"]}&html=true'
timeout = 2
else:
@ -83,7 +88,7 @@ async def main(args):
else:
if x['image2'] is not None:
if 'html_cards' in arg_data and arg_data['html_cards'].lower() == 'true':
if HTML_CARDS:
card_url = f'{x["image2"]}&html=true'
else:
card_url = x['image2']