mirror of
https://github.com/ldericher/fftcgtool
synced 2025-01-15 15:02:59 +00:00
multi opus import
This commit is contained in:
parent
c7938c9f0d
commit
2afb07cb8c
1 changed files with 17 additions and 11 deletions
28
main.py
28
main.py
|
@ -10,18 +10,23 @@ OUT_DIR_NAME = "out" # name of output directory
|
||||||
|
|
||||||
|
|
||||||
def opus_decks(args: argparse.Namespace) -> list[fftcg.TTSDeck]:
|
def opus_decks(args: argparse.Namespace) -> list[fftcg.TTSDeck]:
|
||||||
# import an opus
|
decks: list[fftcg.TTSDeck] = []
|
||||||
opus = fftcg.Opus(args.opus_id, args.language)
|
|
||||||
book = fftcg.Book(opus, args.language, args.num_requests)
|
|
||||||
book.save()
|
|
||||||
|
|
||||||
# load the current carddb
|
for opus_id in args.opus_ids:
|
||||||
carddb = fftcg.CardDB.get()
|
# import an opus
|
||||||
carddb.load()
|
opus = fftcg.Opus(opus_id, args.language)
|
||||||
carddb.update(opus)
|
book = fftcg.Book(opus, args.language, args.num_requests)
|
||||||
|
book.save()
|
||||||
|
|
||||||
|
# load the current carddb
|
||||||
|
carddb = fftcg.CardDB.get()
|
||||||
|
carddb.load()
|
||||||
|
carddb.update(opus)
|
||||||
|
|
||||||
|
decks.extend(opus.elemental_decks)
|
||||||
|
|
||||||
# create elemental decks for opus
|
# create elemental decks for opus
|
||||||
return opus.elemental_decks
|
return decks
|
||||||
|
|
||||||
|
|
||||||
def ffdecks_deck(args: argparse.Namespace) -> list[fftcg.TTSDeck]:
|
def ffdecks_deck(args: argparse.Namespace) -> list[fftcg.TTSDeck]:
|
||||||
|
@ -68,10 +73,11 @@ def main() -> None:
|
||||||
)
|
)
|
||||||
|
|
||||||
opus_parser.add_argument(
|
opus_parser.add_argument(
|
||||||
"opus_id",
|
"opus_ids",
|
||||||
type=str,
|
type=str,
|
||||||
|
nargs="+",
|
||||||
metavar="Opus_ID",
|
metavar="Opus_ID",
|
||||||
help="the Opus to import",
|
help="the Opuses to import",
|
||||||
)
|
)
|
||||||
|
|
||||||
opus_parser.add_argument(
|
opus_parser.add_argument(
|
||||||
|
|
Loading…
Reference in a new issue