Migrated args to constants
This commit is contained in:
parent
863d906657
commit
ac544965ae
@ -15,15 +15,20 @@ logging.basicConfig(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def main(args):
|
CARDSET_NAME = '1998 Live'
|
||||||
arg_data = get_args(args)
|
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}')
|
async def main(args):
|
||||||
c_query = await db_get('cardsets', params=[('name', cardset_name)])
|
print(f'Searching for cardset: {CARDSET_NAME}')
|
||||||
|
c_query = await db_get('cardsets', params=[('name', CARDSET_NAME)])
|
||||||
|
|
||||||
if c_query['count'] == 0:
|
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
|
return
|
||||||
cardset = c_query['cardsets'][0]
|
cardset = c_query['cardsets'][0]
|
||||||
del c_query
|
del c_query
|
||||||
@ -44,11 +49,11 @@ async def main(args):
|
|||||||
start_time = datetime.datetime.now()
|
start_time = datetime.datetime.now()
|
||||||
|
|
||||||
for x in all_players:
|
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
|
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
|
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
|
pass
|
||||||
elif 'sombaseball' in x['image']:
|
elif 'sombaseball' in x['image']:
|
||||||
errors.append((x, f'Bad card url: {x["image"]}'))
|
errors.append((x, f'Bad card url: {x["image"]}'))
|
||||||
@ -56,11 +61,11 @@ async def main(args):
|
|||||||
count += 1
|
count += 1
|
||||||
if count % 20 == 0:
|
if count % 20 == 0:
|
||||||
print(f'Card #{count + 1} being pulled is {x["p_name"]}...')
|
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')
|
print(f'Done test run')
|
||||||
break
|
break
|
||||||
|
|
||||||
if 'html_cards' in arg_data and arg_data['html_cards'].lower() == 'true':
|
if HTML_CARDS:
|
||||||
card_url = f'{x["image"]}&html=true'
|
card_url = f'{x["image"]}&html=true'
|
||||||
timeout = 2
|
timeout = 2
|
||||||
else:
|
else:
|
||||||
@ -83,7 +88,7 @@ async def main(args):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
if x['image2'] is not None:
|
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'
|
card_url = f'{x["image2"]}&html=true'
|
||||||
else:
|
else:
|
||||||
card_url = x['image2']
|
card_url = x['image2']
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user