mirror of
https://github.com/oogg06/cbr2cbz.git
synced 2024-11-25 00:43:16 +01:00
commit
26359244e8
@ -15,9 +15,9 @@ Requirements
|
|||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
||||||
To convert a single CBR file use this (the script can't handle filenames with spaces):
|
To convert a single CBR file use this:
|
||||||
|
|
||||||
``./cbr2cbz.py <cbr_filename_without_spaces>``
|
``./cbr2cbz.py <cbr_filename>``
|
||||||
|
|
||||||
To convert an entire directory with CBR files in it use:
|
To convert an entire directory with CBR files in it use:
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ def uncompress(filename, directory):
|
|||||||
def compress (directory, zip_filename):
|
def compress (directory, zip_filename):
|
||||||
ZIP="zip"
|
ZIP="zip"
|
||||||
directory=directory+"/*"
|
directory=directory+"/*"
|
||||||
command=" ".join([ZIP, zip_filename, directory ])
|
command=" ".join([ZIP, "\""+zip_filename+"\"", directory ])
|
||||||
execute (command)
|
execute (command)
|
||||||
|
|
||||||
def get_filename_without_extension(filename):
|
def get_filename_without_extension(filename):
|
||||||
@ -54,8 +54,7 @@ uncompress(sys.argv[1], temp_dir)
|
|||||||
|
|
||||||
#Compress images and put them into a CBZ/ZIP
|
#Compress images and put them into a CBZ/ZIP
|
||||||
compress(temp_dir, cbz_filename)
|
compress(temp_dir, cbz_filename)
|
||||||
|
execute("".join(["rm -Rf ", temp_dir]))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,25 +13,26 @@ 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)
|
||||||
|
|
||||||
def convert(filename):
|
def convert(filename):
|
||||||
CONVERT="./cbr2cbz.py"
|
CONVERT="./cbr2cbz.py"
|
||||||
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)
|
||||||
convert(filename_with_path)
|
convert(filename_with_path)
|
||||||
|
Loading…
Reference in New Issue
Block a user