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

debug output

This commit is contained in:
Jörn-Michael Miehe 2021-09-06 05:07:11 +02:00
parent a14eb56c33
commit ab7a92dd37
2 changed files with 8 additions and 1 deletions

View file

@ -12,7 +12,7 @@ class Cards(list[Card]):
self.__name = name self.__name = name
def __repr__(self) -> str: 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: def __str__(self) -> str:
return repr(self) return repr(self)

View file

@ -178,18 +178,25 @@ def ffdecks(deck_ids) -> list[fftcg.TTSDeck]:
@main.result_callback() @main.result_callback()
def finalize(decks: list[fftcg.TTSDeck], **kwargs): def finalize(decks: list[fftcg.TTSDeck], **kwargs):
logger = logging.getLogger(__name__)
# decide what to do with the decks # decide what to do with the decks
if kwargs["zip"] is not None: if kwargs["zip"] is not None:
logger.debug("Outputting decks to ZIP")
if decks: if decks:
# create zip file # create zip file
with zipfile.ZipFile(kwargs["zip"], "w", compression=zipfile.ZIP_DEFLATED) as zip_file: with zipfile.ZipFile(kwargs["zip"], "w", compression=zipfile.ZIP_DEFLATED) as zip_file:
# put the decks into that zip file # put the decks into that zip file
for deck in decks: for deck in decks:
logger.debug(f"Saving Deck {deck!r}")
zip_file.writestr(deck.file_name, deck.get_json(kwargs["language"])) zip_file.writestr(deck.file_name, deck.get_json(kwargs["language"]))
else: else:
logger.debug("Outputting decks to disk")
# save the decks to disk # save the decks to disk
for deck in decks: for deck in decks:
logger.debug(f"Saving Deck {deck!r}")
deck.save(kwargs["language"]) deck.save(kwargs["language"])
# bye # bye