text stringlengths 1 93.6k |
|---|
call(["git", "checkout", "master"], stdout=FNULL, stderr=FNULL)
|
call(["git", "pull"], stdout=FNULL, stderr=FNULL)
|
print(f"Successfully updated to v{new_version}. Please restart s3s.")
|
sys.exit(0)
|
else:
|
print("Please update to the latest version by running " \
|
'`\033[91m' + "git pull" + '\033[0m' \
|
"` as soon as possible.\n")
|
else: # no git directory
|
print(" Visit the site below to update:\nhttps://github.com/frozenpandaman/s3s\n")
|
except Exception as e: # if there's a problem connecting to github
|
print('\033[3m' + "» Couldn't connect to GitHub. Please update the script manually via " \
|
'`\033[91m' + "git pull" + '\033[0m' + "`." + '\033[0m' + "\n")
|
# print('\033[3m' + "» While s3s is in beta, please update the script regularly via " \
|
# '`\033[91m' + "git pull" + '\033[0m' + "`." + '\033[0m' + "\n")
|
def check_statink_key():
|
'''Checks if a valid length API key has been provided and, if not, prompts the user to enter one.'''
|
if API_KEY == "skip":
|
return
|
elif len(API_KEY) != 43:
|
new_api_key = ""
|
while len(new_api_key.strip()) != 43 and new_api_key.strip() != "skip":
|
if new_api_key.strip() == "" and API_KEY.strip() == "":
|
new_api_key = input("stat.ink API key: ")
|
else:
|
print("Invalid stat.ink API key. Please re-enter it below.")
|
new_api_key = input("stat.ink API key: ")
|
CONFIG_DATA["api_key"] = new_api_key
|
write_config(CONFIG_DATA)
|
return
|
def set_language():
|
'''Prompts the user to set their game language.'''
|
if USER_LANG == "":
|
print("Default locale is en-US. Press Enter to accept, or enter your own (see readme for list).")
|
language_code = input("")
|
if language_code == "":
|
CONFIG_DATA["acc_loc"] = "en-US|US" # default
|
write_config(CONFIG_DATA)
|
return
|
else:
|
language_list = [
|
"de-DE", "en-GB", "en-US", "es-ES", "es-MX", "fr-CA", "fr-FR",
|
"it-IT", "ja-JP", "ko-KR", "nl-NL", "ru-RU", "zh-CN", "zh-TW"
|
]
|
while language_code not in language_list:
|
print("Invalid language code. Please try entering it again:")
|
language_code = input("")
|
CONFIG_DATA["acc_loc"] = f"{language_code}|US" # default to US until set by ninty
|
write_config(CONFIG_DATA)
|
return
|
def get_num_results(which):
|
'''I/O for getting number of battles/jobs to upload.'''
|
noun = utils.set_noun(which)
|
try:
|
if which == "ink":
|
print(f"Note: This is an atypical way to run the script for manually specifying the number of recent " \
|
"battles to upload, with a maximum of 50. Up to 250 recent battles (50 of each type) can be " \
|
"uploaded automatically by appending the " + '\033[91m' + "-r" + '\033[0m' + " flag.\n")
|
elif which == "salmon":
|
print(f"Note: This is an atypical way to run the script for manually specifying the number of recent " \
|
"Salmon Run jobs to upload. All 50 recent jobs can be uploaded automatically by appending the " \
|
'\033[91m' + "-r" + '\033[0m' + " flag.\n")
|
n = int(input(f"Number of recent {noun} to upload (0-50)? "))
|
print()
|
except ValueError:
|
print("Please enter an integer between 0 and 50. Exiting.")
|
sys.exit(0)
|
if n == 0:
|
print("Exiting without uploading anything.")
|
sys.exit(0)
|
elif n < 0:
|
print("No.")
|
sys.exit(0)
|
elif n > 50:
|
if which == "salmon":
|
print("SplatNet 3 only stores the 50 most recent jobs. Exiting.")
|
elif which == "ink":
|
print("In this mode, s3s can only fetch the 50 most recent battles (of any type) at once. " \
|
"Run the script with " \
|
'\033[91m' + "-r" + '\033[0m' + " to fetch more than 50 results. Exiting.")
|
sys.exit(0)
|
else:
|
return n
|
def fetch_and_upload_single_result(hash_, noun, isblackout, istestrun):
|
'''Performs a GraphQL request for a single vsResultId/coopHistoryDetailId and call post_result().'''
|
if noun in ("battles", "battle"):
|
dict_key = "VsHistoryDetailQuery"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.