text stringlengths 1 93.6k |
|---|
dict_key2 = "vsResultId"
|
lang = None
|
else: # noun == "jobs" or "job"
|
dict_key = "CoopHistoryDetailQuery"
|
dict_key2 = "coopHistoryDetailId"
|
lang = 'en-US'
|
result_post = requests.post(iksm.GRAPHQL_URL,
|
data=utils.gen_graphql_body(utils.translate_rid[dict_key], dict_key2, hash_),
|
headers=headbutt(forcelang=lang),
|
cookies=dict(_gtoken=GTOKEN))
|
try:
|
result = json.loads(result_post.text)
|
post_result(result, False, isblackout, istestrun) # not monitoring mode
|
except json.decoder.JSONDecodeError: # retry once, hopefully avoid a few errors
|
result_post = requests.post(iksm.GRAPHQL_URL,
|
data=utils.gen_graphql_body(utils.translate_rid[dict_key], dict_key2, hash_),
|
headers=headbutt(forcelang=lang),
|
cookies=dict(_gtoken=GTOKEN))
|
try:
|
result = json.loads(result_post.text)
|
post_result(result, False, isblackout, istestrun)
|
except json.decoder.JSONDecodeError:
|
if utils.custom_key_exists("errors_pass_silently", CONFIG_DATA):
|
print("Error uploading one of your battles. Continuing...")
|
pass
|
else:
|
print(f"(!) Error uploading one of your battles. Please try running s3s again. This may also be an error on Nintendo's end. See https://github.com/frozenpandaman/s3s/issues/189 for more info. Use the `errors_pass_silently` config key to skip this {noun} and continue running the script.")
|
sys.exit(1)
|
def check_if_missing(which, isblackout, istestrun, skipprefetch):
|
'''Checks for unuploaded battles and uploads any that are found (-r flag).'''
|
noun = utils.set_noun(which)
|
print(f"Checking if there are previously-unuploaded {noun}...")
|
urls = []
|
# https://github.com/fetus-hina/stat.ink/wiki/Spl3-API:-Battle-%EF%BC%8D-Get-UUID-List-(for-s3s)
|
# https://github.com/fetus-hina/stat.ink/wiki/Spl3-API:-Salmon-%EF%BC%8D-Get-UUID-List
|
if which in ("both", "ink"):
|
urls.append("https://stat.ink/api/v3/s3s/uuid-list?lobby=adaptive") # max 250 entries
|
else:
|
urls.append(None)
|
if which in ("both", "salmon"):
|
urls.append("https://stat.ink/api/v3/salmon/uuid-list")
|
else:
|
urls.append(None)
|
noun = "battles" # first (and maybe only)
|
which = "ink"
|
for url in urls:
|
if url is not None:
|
printed = False
|
auth = {'Authorization': f'Bearer {API_KEY}'}
|
resp = requests.get(url, headers=auth)
|
try:
|
statink_uploads = json.loads(resp.text)
|
except:
|
if utils.custom_key_exists("errors_pass_silently", CONFIG_DATA):
|
print(f"Error while checking recently-uploaded {noun}. Continuing...")
|
else:
|
print(f"Error while checking recently-uploaded {noun}. Is stat.ink down?")
|
sys.exit(1)
|
# ! fetch from online
|
# specific - check ALL possible battles; printout - to show tokens are being checked at program start
|
splatnet_ids = fetch_json(which, specific=True, numbers_only=True, printout=True, skipprefetch=skipprefetch)
|
# same as code in -i section below...
|
for id in reversed(splatnet_ids):
|
full_id = utils.b64d(id)
|
if which == "ink":
|
old_battle_uuid = full_id[-36:]
|
new_battle_uuid = str(uuid.uuid5(utils.S3S_NAMESPACE, full_id[-52:]))
|
if new_battle_uuid in statink_uploads:
|
continue
|
if old_battle_uuid in statink_uploads:
|
if not utils.custom_key_exists("force_uploads", CONFIG_DATA):
|
continue
|
elif which == "salmon":
|
old_job_uuid = str(uuid.uuid5(utils.SALMON_NAMESPACE, full_id[-52:])) # used to do it incorrectly
|
new_job_uuid = str(uuid.uuid5(utils.SALMON_NAMESPACE, full_id))
|
if new_job_uuid in statink_uploads:
|
continue
|
if old_job_uuid in statink_uploads: # extremely low chance of conflicts... but force upload if so
|
if not utils.custom_key_exists("force_uploads", CONFIG_DATA):
|
continue
|
if not printed:
|
printed = True
|
print(f"Previously-unuploaded {noun} detected. Uploading now...")
|
fetch_and_upload_single_result(id, noun, isblackout, istestrun)
|
if not printed:
|
print(f"No previously-unuploaded {noun} found.")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.