Skip to content

Commit

Permalink
Update leaderboards.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tposejank authored Aug 27, 2024
1 parent eb345f5 commit a8ef1fb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion leaderboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
import copy

accid = os.getenv('ACCOUNT_ID')

max_duration_eg1 = 6900 # nice
bar_is_allowed_b = True
eg1_made_at_time = 17

def print_progress_bar(iteration, total, length=50):
percent = ("{0:.1f}").format(100 * (iteration / float(total)))
filled_length = int(length * iteration // total)
bar = '█' * filled_length + '-' * (length - filled_length)
if not bar_is_allowed_b: return
sys.stdout.write(f'\r|{bar}| {percent}% Complete')
sys.stdout.flush()

Expand Down Expand Up @@ -189,13 +192,15 @@ def main():

print('Generating Device Auth EG1')
eg1_params = {

"grant_type": "device_auth",
"account_id": os.getenv('ACCOUNT_ID'),
"device_id": os.getenv('DEVICE_ID'),
"secret": os.getenv('SECRET'),
"token_type": "eg1"
}
authHeader = os.getenv('BASIC_AUTH')

eg1_data = getEG1Token(eg1_params, authHeader)
token_eg1 = eg1_data['access_token']
eg1_made_at_time = datetime.datetime.now().timestamp()
Expand Down Expand Up @@ -281,7 +286,10 @@ def userShit(ss, sid, ins, pg, lb):
if uname_to_use:
copiedEntry['userName'] = uname_to_use
elif len(users[entry['teamId']]['externalNames']) > 1:
copiedEntry['userName'] = '[' + users[entry['teamId']]['externalNames'][0]['type'] + '] ' + users[entry['teamId']]['externalNames'][0]['displayName']
uplat = users[entry['teamId']]['externalNames'][0]['type']
uplatdname = users[entry['teamId']]['externalNames'][0]['displayName']
finalname = '[' + uplat + '] ' + uplatdname
copiedEntry['userName'] = finalname
lb['entries'][i] = copiedEntry

# with open(f'leaderboards/season{ss}/{sid}/{ins}_{pg}_Users.json', 'w') as usersFile:
Expand Down

0 comments on commit a8ef1fb

Please sign in to comment.