From c4b29aeb4b068930dba0b0b822faab6fae2fc917 Mon Sep 17 00:00:00 2001 From: Nicolas Morey-Chaisemartin Date: Tue, 19 Jun 2018 17:04:12 +0200 Subject: [PATCH] * cbrfolder2cbz.py: Support converting multiple directories at once Signed-off-by: Nicolas Morey-Chaisemartin --- cbrfolder2cbz.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cbrfolder2cbz.py b/cbrfolder2cbz.py index 364e028..f36be92 100755 --- a/cbrfolder2cbz.py +++ b/cbrfolder2cbz.py @@ -13,7 +13,7 @@ def print_err(message): def print_usage(): usage="cbr2cbz A script utility to convert a directory with CBR files into CBZ files" - usage+="\n\t Usage: cbr2cbz " + usage+="\n\t Usage: cbr2cbz [ ...]" usage+="\n\t\n\t (Please don't use non-free formats like RAR/CBR)" print_err(usage) @@ -22,16 +22,17 @@ def convert(filename): command=" ".join([CONVERT, "\""+filename+"\""]) execute(command) -if len(sys.argv)!=2: +if len(sys.argv)<2: print_usage(); sys.exit(-1) +sys.argv.pop(0) - -directory=os.path.abspath(sys.argv[1]) - -for f in os.listdir(directory): - filename_with_path=os.path.join(directory, f) - print(filename_with_path) - convert(filename_with_path) \ No newline at end of file +for dir in sys.argv: + print dir + directory=os.path.abspath(dir) + for f in os.listdir(directory): + filename_with_path=os.path.join(directory, f) + print(filename_with_path) + convert(filename_with_path)