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 01:41:14 +00:00
|
|
|
from fftcg.opus import Opus
|
2021-08-04 16:36:23 +00:00
|
|
|
from fftcg.book import Book
|
2018-11-02 22:13:17 +00:00
|
|
|
|
|
|
|
|
2021-08-03 21:41:25 +00:00
|
|
|
def main():
|
2021-08-04 16:36:23 +00:00
|
|
|
# Setup CLI
|
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
description='Imports FFTCG cards for TT-Sim.')
|
2018-11-02 22:13:17 +00:00
|
|
|
|
2021-08-04 16:36:23 +00:00
|
|
|
parser.add_argument(
|
|
|
|
'opusid',
|
|
|
|
default="2",
|
|
|
|
metavar="OpusID",
|
|
|
|
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()
|
|
|
|
|
|
|
|
# Setup logging
|
|
|
|
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(threadName)s %(message)s')
|
|
|
|
|
|
|
|
opus = Opus(args.opusid)
|
|
|
|
|
|
|
|
# output directory
|
|
|
|
if not os.path.exists("out"):
|
|
|
|
os.mkdir("out")
|
|
|
|
os.chdir("out")
|
|
|
|
|
|
|
|
book = Book(opus, (7, 10), (429, 600), "eg", 16)
|
|
|
|
book.save(f"opus_{args.opusid}_{{}}.jpg")
|
2021-08-04 01:39:19 +00:00
|
|
|
|
2018-11-02 22:13:17 +00:00
|
|
|
|
2021-08-02 23:55:12 +00:00
|
|
|
if __name__ == '__main__':
|
2021-08-03 21:41:25 +00:00
|
|
|
main()
|