added anonymous login to gen emu script, has very limited access

This commit is contained in:
otavepto 2023-12-29 09:24:34 +02:00
parent 21eeb85bd7
commit 512eb4e0bf

View File

@ -504,6 +504,7 @@ def help():
print(" -cdx: generate .ini file for CODEX Steam emu for each app") print(" -cdx: generate .ini file for CODEX Steam emu for each app")
print(" -aw: generate schemas of all possible languages for Achievement Watcher") print(" -aw: generate schemas of all possible languages for Achievement Watcher")
print(" -clean: delete any folder/file with the same name as the output before generating any data") print(" -clean: delete any folder/file with the same name as the output before generating any data")
print(" -anon: login as with an anonymous account, these have very limited access and cannot get all app details")
print("\nAll switches are optional except app id, at least 1 app id must be provided\n") print("\nAll switches are optional except app id, at least 1 app id must be provided\n")
@ -519,6 +520,7 @@ def main():
GENERATE_CODEX_INI = False GENERATE_CODEX_INI = False
GENERATE_ACHIEVEMENT_WATCHER_SCHEMAS = False GENERATE_ACHIEVEMENT_WATCHER_SCHEMAS = False
CLEANUP_BEFORE_GENERATING = False CLEANUP_BEFORE_GENERATING = False
ANON_LOGIN = False
prompt_for_unavailable = True prompt_for_unavailable = True
@ -546,6 +548,8 @@ def main():
GENERATE_ACHIEVEMENT_WATCHER_SCHEMAS = True GENERATE_ACHIEVEMENT_WATCHER_SCHEMAS = True
elif f'{appid}'.lower() == '-clean': elif f'{appid}'.lower() == '-clean':
CLEANUP_BEFORE_GENERATING = True CLEANUP_BEFORE_GENERATING = True
elif f'{appid}'.lower() == '-anon':
ANON_LOGIN = True
else: else:
print(f'[X] invalid switch: {appid}') print(f'[X] invalid switch: {appid}')
help() help()
@ -561,7 +565,7 @@ def main():
os.makedirs("login_temp") os.makedirs("login_temp")
client.set_credential_location("login_temp") client.set_credential_location("login_temp")
if os.path.isfile("my_login.txt"): if not ANON_LOGIN and os.path.isfile("my_login.txt"):
filedata = [''] filedata = ['']
with open("my_login.txt", "r") as f: with open("my_login.txt", "r") as f:
filedata = f.readlines() filedata = f.readlines()
@ -571,7 +575,14 @@ def main():
USERNAME = filedata[0] USERNAME = filedata[0]
PASSWORD = filedata[1] PASSWORD = filedata[1]
if (len(USERNAME) == 0 or len(PASSWORD) == 0): if ANON_LOGIN:
result = client.anonymous_login()
trials = 5
while result != EResult.OK and trials > 0:
time.sleep(1000)
result = client.anonymous_login()
trials -= 1
elif (len(USERNAME) == 0 or len(PASSWORD) == 0):
client.cli_login() client.cli_login()
else: else:
result = client.login(USERNAME, password=PASSWORD) result = client.login(USERNAME, password=PASSWORD)