Files
2024-08-09 17:57:50 -05:00

37 lines
1.1 KiB
Python

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()
logging.getLogger('img2pdf').setLevel(logging.CRITICAL)
logging.getLogger('patoolib').setLevel(logging.CRITICAL)
# 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)]