import re import argparse import logging parser = argparse.ArgumentParser( description="A comic archive to pdf converter.", formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) parser.add_argument("source", type=str, help="source of file/folder with .cbz or .cbr format") parser.add_argument( "destination", type=str, help="ouptput of the converted files" ) parser.add_argument("-v", "--verbose", action="store_true", help="debug mode") args = parser.parse_args() src = args.source dest = args.destination verbose = args.verbose if verbose: logging.basicConfig(level=logging.DEBUG, format="[%(levelname)s] - %(message)s") else: logging.basicConfig(level=logging.INFO, format="[%(levelname)s] - %(message)s") log = logging.getLogger() # got this from the internet class Sorter: def atoi(self, text): return int(text) if text.isdigit() else text def natural_keys(self, text): return [self.atoi(c) for c in re.split(r"(d )", text)]