mirror of
https://github.com/ldericher/fftcgtool
synced 2025-01-15 06:53:00 +00:00
debug output
This commit is contained in:
parent
a14eb56c33
commit
ab7a92dd37
2 changed files with 8 additions and 1 deletions
|
@ -12,7 +12,7 @@ class Cards(list[Card]):
|
|||
self.__name = name
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"[{', '.join(str(card) for card in self)}]"
|
||||
return f"{self.name!r} ({len(self)} Cards)"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return repr(self)
|
||||
|
|
|
@ -178,18 +178,25 @@ def ffdecks(deck_ids) -> list[fftcg.TTSDeck]:
|
|||
|
||||
@main.result_callback()
|
||||
def finalize(decks: list[fftcg.TTSDeck], **kwargs):
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# decide what to do with the decks
|
||||
if kwargs["zip"] is not None:
|
||||
logger.debug("Outputting decks to ZIP")
|
||||
if decks:
|
||||
# create zip file
|
||||
with zipfile.ZipFile(kwargs["zip"], "w", compression=zipfile.ZIP_DEFLATED) as zip_file:
|
||||
# put the decks into that zip file
|
||||
for deck in decks:
|
||||
logger.debug(f"Saving Deck {deck!r}")
|
||||
zip_file.writestr(deck.file_name, deck.get_json(kwargs["language"]))
|
||||
|
||||
else:
|
||||
logger.debug("Outputting decks to disk")
|
||||
|
||||
# save the decks to disk
|
||||
for deck in decks:
|
||||
logger.debug(f"Saving Deck {deck!r}")
|
||||
deck.save(kwargs["language"])
|
||||
|
||||
# bye
|
||||
|
|
Loading…
Reference in a new issue