1
0
Fork 0
mirror of https://github.com/ldericher/fftcgtool synced 2025-01-15 15:02:59 +00:00

Formatting

This commit is contained in:
Jörn-Michael Miehe 2021-08-09 06:18:56 +02:00
parent 3ab8bcfc31
commit 758958dca3
2 changed files with 22 additions and 19 deletions

View file

@ -3,14 +3,14 @@ import re
class Card:
__ELEMENTS_MAP = {
'': "Fire",
'': "Ice",
'': "Wind",
'': "Earth",
'': "Lightning",
'': "Water",
'': "Light",
'': "Darkness"
"": "Fire",
"": "Ice",
"": "Wind",
"": "Earth",
"": "Lightning",
"": "Water",
"": "Light",
"": "Darkness"
}
def __init__(self, data: dict[str, any], language: str = "EN"):
@ -25,18 +25,18 @@ class Card:
if str(data["Code"])[0].isnumeric():
# card code starts with a number
self.__opus, self.__serial, self.__rarity = \
re.match(r'([0-9]+)-([0-9]+)([CRHLS])', data["Code"]).groups()
re.match(r"([0-9]+)-([0-9]+)([CRHLS])", data["Code"]).groups()
elif str(data["Code"]).startswith("PR"):
# card code starts with "PR"
self.__opus, self.__serial = \
re.match(r'(PR)-([0-9]+)', data["Code"]).groups()
re.match(r"(PR)-([0-9]+)", data["Code"]).groups()
self.__rarity = ""
elif str(data["Code"]).startswith("B"):
# card code starts with "B"
self.__opus, self.__serial = \
re.match(r'(B)-([0-9]+)', data["Code"]).groups()
re.match(r"(B)-([0-9]+)", data["Code"]).groups()
self.__rarity = ""
else:

19
main.py
View file

@ -14,26 +14,29 @@ RESOLUTION = 429, 600 # default in TTsim: 480x670 pixels per card
def main() -> None:
# set up CLI
parser = argparse.ArgumentParser(
description='Imports FFTCG cards for TT-Sim.')
description="Imports FFTCG cards for TT-Sim.",
)
parser.add_argument(
'opus_id',
default="1",
"opus_id",
default="promo",
metavar="Opus_ID",
nargs="?",
help='the Opus to import')
help="the Opus to import",
)
parser.add_argument(
'-n', '--num_threads',
"-n", "--num_threads",
type=int,
default=20,
metavar="COUNT",
help='maximum number of concurrent requests')
help="maximum number of concurrent requests",
)
args = parser.parse_args()
# set up logging
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(threadName)s %(message)s')
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(threadName)s %(message)s")
# output directory
if not os.path.exists("out"):
@ -50,5 +53,5 @@ def main() -> None:
logging.info("Thanks for using fftcgtool!")
if __name__ == '__main__':
if __name__ == "__main__":
main()