text stringlengths 1 93.6k |
|---|
help="export all possible results to local files")
|
parser.add_argument("-i", dest="path", nargs=2, required=False,
|
help="upload local results: `-i (coop_)results/ overview.json`")
|
parser.add_argument("-t", required=False, action="store_true",
|
help="dry run for testing (won't post to stat.ink)")
|
parser.add_argument("--getseed", required=False, action="store_true",
|
help="export JSON for gear & Shell-Out Machine seed checker")
|
parser.add_argument("--skipprefetch", required=False, action="store_true", help=argparse.SUPPRESS)
|
return parser.parse_args()
|
def main():
|
'''Main process, including I/O and setup.'''
|
print('\033[93m\033[1m' + "s3s" + '\033[0m\033[93m' + f" v{A_VERSION}" + '\033[0m')
|
# argparse setup
|
################
|
parser_result = parse_arguments()
|
# regular args
|
n_value = parser_result.N
|
check_old = parser_result.r
|
only_ink = parser_result.nsr # ink battles ONLY
|
only_salmon = parser_result.osr # salmon run ONLY
|
blackout = parser_result.blackout
|
getseed = parser_result.getseed
|
# testing/dev stuff
|
test_run = parser_result.t # send to stat.ink as dry run
|
file_paths = parser_result.path # intended for results/ or coop_results/ AND overview.json
|
outfile = parser_result.o # output to local files
|
skipprefetch = parser_result.skipprefetch # skip prefetch checks to ensure token validity
|
# setup
|
#######
|
check_for_updates()
|
if not getseed:
|
check_statink_key()
|
set_language()
|
# i/o checks
|
############
|
if getseed and len(sys.argv) > 2 and "--skipprefetch" not in sys.argv:
|
print("Cannot use --getseed with other arguments. Exiting.")
|
sys.exit(0)
|
elif getseed:
|
export_seed_json(skipprefetch)
|
sys.exit(0)
|
elif only_ink and only_salmon:
|
print("That doesn't make any sense! :) Exiting.")
|
sys.exit(0)
|
elif outfile and len(sys.argv) > 2 and "--skipprefetch" not in sys.argv:
|
print("Cannot use -o with other arguments. Exiting.")
|
sys.exit(0)
|
secs = -1
|
if n_value is not None:
|
try:
|
secs = int(parser_result.N)
|
except ValueError:
|
print("Number provided must be an integer. Exiting.")
|
sys.exit(0)
|
if secs < 0:
|
print("No.")
|
sys.exit(0)
|
elif secs < 60:
|
print("Minimum number of seconds in monitoring mode is 60. Exiting.")
|
sys.exit(0)
|
# export results to file: -o flag
|
#################################
|
if outfile:
|
if not skipprefetch:
|
prefetch_checks(printout=True)
|
print("Fetching your JSON files to export locally. This might take a while...")
|
# ! fetch from online - fetch_json() calls prefetch_checks() to gen or check tokens
|
parents, results, coop_results = fetch_json("both", separate=True, exportall=True, specific=True, skipprefetch=True)
|
cwd = os.getcwd()
|
if utils.custom_key_exists("old_export_format", CONFIG_DATA):
|
export_dir = os.path.join(cwd, f'export-{int(time.time())}')
|
overview_filename = "overview.json"
|
else:
|
export_dir = os.path.join(cwd, 'exports')
|
utc_time = datetime.datetime.utcnow().strftime('%Y%m%dT%H%M%SZ')
|
overview_filename = f'overview-{utc_time}.json'
|
if not os.path.exists(export_dir):
|
os.makedirs(export_dir)
|
print()
|
if parents is not None:
|
with open(os.path.join(cwd, export_dir, overview_filename), "x") as fout:
|
json.dump(parents, fout)
|
print(f'Created {overview_filename} with general info about battle/job stats.')
|
if results is not None:
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.