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

55 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-04 16:36:23 +00:00
from fftcg.book import Book
from fftcg.opus import Opus
# constants
GRID = 7, 10 # default in TTsim: 7 rows, 10 columns
RESOLUTION = 429, 600 # default in TTsim: 480x670 pixels per card
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(
description='Imports FFTCG cards for TT-Sim.')
2021-08-04 16:36:23 +00:00
parser.add_argument(
'opus_id',
default="1",
2021-08-04 22:54:15 +00:00
metavar="Opus_ID",
2021-08-04 16:36:23 +00:00
nargs="?",
help='the Opus to import')
parser.add_argument(
'-n', '--num_threads',
type=int,
default=20,
metavar="COUNT",
help='maximum number of concurrent requests')
args = parser.parse_args()
# set up logging
2021-08-04 16:36:23 +00:00
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(threadName)s %(message)s')
# output directory
if not os.path.exists("out"):
os.mkdir("out")
os.chdir("out")
# main program
opus = Opus(args.opus_id)
2021-08-04 22:54:15 +00:00
book = Book(opus, GRID, RESOLUTION, "eg", args.num_threads)
book.save(f"{opus.name}_{{}}.jpg")
# 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-02 23:55:12 +00:00
if __name__ == '__main__':
2021-08-03 21:41:25 +00:00
main()