* cbrfolder2cbz.py: Support converting multiple directories at once

Signed-off-by: Nicolas Morey-Chaisemartin <NMoreyChaisemartin@suse.com>
This commit is contained in:
Nicolas Morey-Chaisemartin 2018-06-19 17:04:12 +02:00
parent 312617e069
commit c4b29aeb4b

View File

@ -13,7 +13,7 @@ def print_err(message):
def print_usage(): def print_usage():
usage="cbr2cbz A script utility to convert a directory with CBR files into CBZ files" usage="cbr2cbz A script utility to convert a directory with CBR files into CBZ files"
usage+="\n\t Usage: cbr2cbz <directory>" usage+="\n\t Usage: cbr2cbz <directory> [<directory> <directory> ...]"
usage+="\n\t\n\t (Please don't use non-free formats like RAR/CBR)" usage+="\n\t\n\t (Please don't use non-free formats like RAR/CBR)"
print_err(usage) print_err(usage)
@ -22,15 +22,16 @@ def convert(filename):
command=" ".join([CONVERT, "\""+filename+"\""]) command=" ".join([CONVERT, "\""+filename+"\""])
execute(command) execute(command)
if len(sys.argv)!=2: if len(sys.argv)<2:
print_usage(); print_usage();
sys.exit(-1) sys.exit(-1)
sys.argv.pop(0)
for dir in sys.argv:
directory=os.path.abspath(sys.argv[1]) print dir
directory=os.path.abspath(dir)
for f in os.listdir(directory): for f in os.listdir(directory):
filename_with_path=os.path.join(directory, f) filename_with_path=os.path.join(directory, f)
print(filename_with_path) print(filename_with_path)