1
0
Fork 0
mirror of https://github.com/ldericher/fftcgtool synced 2025-01-15 23:03:00 +00:00
fftcgtool/main.py

61 lines
1.3 KiB
Python
Raw Normal View History

2021-08-03 00:22:00 +00:00
#!/usr/bin/env python3
2021-08-04 16:36:23 +00:00
import argparse
import logging
import os
2021-08-03 00:22:00 +00:00
2021-08-09 05:01:25 +00:00
import fftcg
2021-08-09 02:03:24 +00:00
def main() -> None:
# set up CLI
2021-08-04 16:36:23 +00:00
parser = argparse.ArgumentParser(
2021-08-09 04:18:56 +00:00
description="Imports FFTCG cards for TT-Sim.",
)
2021-08-04 16:36:23 +00:00
parser.add_argument(
2021-08-09 04:18:56 +00:00
"opus_id",
default="promo",
2021-08-04 22:54:15 +00:00
metavar="Opus_ID",
2021-08-04 16:36:23 +00:00
nargs="?",
2021-08-09 04:18:56 +00:00
help="the Opus to import",
)
2021-08-04 16:36:23 +00:00
parser.add_argument(
2021-08-09 04:18:56 +00:00
"-n", "--num_threads",
2021-08-04 16:36:23 +00:00
type=int,
default=20,
metavar="COUNT",
2021-08-09 04:18:56 +00:00
help="maximum number of concurrent requests",
)
2021-08-04 16:36:23 +00:00
args = parser.parse_args()
# set up logging
2021-08-09 04:18:56 +00:00
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(threadName)s %(message)s")
2021-08-04 16:36:23 +00:00
# output directory
if not os.path.exists("out"):
os.mkdir("out")
os.chdir("out")
# main program
2021-08-09 05:01:25 +00:00
opus = fftcg.Opus(args.opus_id)
2021-08-17 15:37:28 +00:00
book = fftcg.Book(opus, "eg", args.num_threads)
2021-08-18 11:49:34 +00:00
book.save(opus.file_name)
2021-08-16 12:45:15 +00:00
2021-08-18 11:49:34 +00:00
# load the current carddb
2021-08-17 15:37:28 +00:00
carddb = fftcg.CardDB.get()
carddb.load()
2021-08-16 12:45:15 +00:00
2021-08-18 11:49:34 +00:00
# create elemental decks for opus
2021-08-17 15:37:28 +00:00
for deck in opus.elemental_decks:
print(deck)
# bye
logging.info("Done. Put the generated JSON files in your 'Saved Objects' Folder.")
logging.info("Thanks for using fftcgtool!")
2021-08-04 01:39:19 +00:00
2021-08-09 04:18:56 +00:00
if __name__ == "__main__":
2021-08-03 21:41:25 +00:00
main()