mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 17:56:30 +00:00
Little cleaning and normalisation
This commit is contained in:
@@ -411,8 +411,8 @@ def Copyright():
|
|||||||
|
|
||||||
|
|
||||||
def Usage():
|
def Usage():
|
||||||
print "Generates HTML, NCX and OPF for a Comic ebook from a bunch of images"
|
print "Generates HTML, NCX and OPF for a Comic ebook from a bunch of images."
|
||||||
print "Optimized for creating Mobipockets to be read into Kindle Paperwhite"
|
print "Optimized for creating MOBI files to be read on Kindle Paperwhite."
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
|
||||||
|
|
||||||
@@ -421,34 +421,34 @@ def main(argv=None):
|
|||||||
usage = "Usage: %prog [options] comic_file|comic_folder"
|
usage = "Usage: %prog [options] comic_file|comic_folder"
|
||||||
parser = OptionParser(usage=usage, version=__version__)
|
parser = OptionParser(usage=usage, version=__version__)
|
||||||
parser.add_option("-p", "--profile", action="store", dest="profile", default="KHD",
|
parser.add_option("-p", "--profile", action="store", dest="profile", default="KHD",
|
||||||
help="Device profile (choose one among K1, K2, K3, K4, KDX, KDXG or KHD) [default=KHD]")
|
help="Device profile (Choose one among K1, K2, K3, K4, KDX, KDXG or KHD) [Default=KHD]")
|
||||||
parser.add_option("-t", "--title", action="store", dest="title", default="defaulttitle",
|
parser.add_option("-t", "--title", action="store", dest="title", default="defaulttitle",
|
||||||
help="Comic title [default=filename]")
|
help="Comic title [Default=filename]")
|
||||||
parser.add_option("-m", "--manga-style", action="store_true", dest="righttoleft", default=False,
|
parser.add_option("-m", "--manga-style", action="store_true", dest="righttoleft", default=False,
|
||||||
help="'Manga style' (right-to-left reading and splitting) [default=False]")
|
help="Manga style (Right-to-left reading and splitting) [Default=False]")
|
||||||
parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False,
|
parser.add_option("--noprocessing", action="store_false", dest="imgproc", default=True,
|
||||||
help="Verbose output [default=False]")
|
help="Do not apply image preprocessing (Page splitting and optimizations) [Default=True]")
|
||||||
parser.add_option("--no-image-processing", action="store_false", dest="imgproc", default=True,
|
|
||||||
help="Do not apply image preprocessing (page splitting and optimizations) [default=True]")
|
|
||||||
parser.add_option("--gamma", type="float", dest="gamma", default="0.0",
|
|
||||||
help="Apply gamma correction to linearize the image [default=auto]")
|
|
||||||
parser.add_option("--nodithering", action="store_true", dest="notquantize", default=False,
|
parser.add_option("--nodithering", action="store_true", dest="notquantize", default=False,
|
||||||
help="Disable image quantization [default=False]")
|
help="Disable image quantization [Default=False]")
|
||||||
parser.add_option("--upscale-images", action="store_true", dest="upscale", default=False,
|
parser.add_option("--gamma", type="float", dest="gamma", default="0.0",
|
||||||
help="Resize images smaller than device's resolution [default=False]")
|
help="Apply gamma correction to linearize the image [Default=Auto]")
|
||||||
parser.add_option("--stretch-images", action="store_true", dest="stretch", default=False,
|
parser.add_option("--upscale", action="store_true", dest="upscale", default=False,
|
||||||
help="Stretch images to device's resolution [default=False]")
|
help="Resize images smaller than device's resolution [Default=False]")
|
||||||
parser.add_option("--black-borders", action="store_true", dest="black_borders", default=False,
|
parser.add_option("--stretch", action="store_true", dest="stretch", default=False,
|
||||||
help="Use black borders (instead of white ones) when not stretching and ratio "
|
help="Stretch images to device's resolution [Default=False]")
|
||||||
+ "is not like the device's one [default=False]")
|
parser.add_option("--blackborders", action="store_true", dest="black_borders", default=False,
|
||||||
parser.add_option("--no-cut-page-numbers", action="store_false", dest="cutpagenumbers", default=True,
|
help="Use black borders (Instead of white ones) when not stretching and ratio "
|
||||||
help="Do not try to cut page numbering on images [default=True]")
|
+ "is not like the device's one [Default=False]")
|
||||||
parser.add_option("--nosplitrotate", action="store_true", dest="nosplitrotate", default=False,
|
|
||||||
help="Disable splitting and rotation [default=False]")
|
|
||||||
parser.add_option("--rotate", action="store_true", dest="rotate", default=False,
|
parser.add_option("--rotate", action="store_true", dest="rotate", default=False,
|
||||||
help="Rotate landscape pages instead of splitting them [default=False]")
|
help="Rotate landscape pages instead of splitting them [Default=False]")
|
||||||
|
parser.add_option("--nosplitrotate", action="store_true", dest="nosplitrotate", default=False,
|
||||||
|
help="Disable splitting and rotation [Default=False]")
|
||||||
|
parser.add_option("--nocutpagenumbers", action="store_false", dest="cutpagenumbers", default=True,
|
||||||
|
help="Do not try to cut page numbering on images [Default=True]")
|
||||||
parser.add_option("-o", "--output", action="store", dest="output", default=None,
|
parser.add_option("-o", "--output", action="store", dest="output", default=None,
|
||||||
help="Output directory or file for generated ePub")
|
help="Output generated EPUB to specified directory or file")
|
||||||
|
parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False,
|
||||||
|
help="Verbose output [Default=False]")
|
||||||
options, args = parser.parse_args(argv)
|
options, args = parser.parse_args(argv)
|
||||||
if len(args) != 1:
|
if len(args) != 1:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
@@ -457,9 +457,9 @@ def main(argv=None):
|
|||||||
if options.title == 'defaulttitle':
|
if options.title == 'defaulttitle':
|
||||||
options.title = os.path.splitext(os.path.basename(args[0]))[0]
|
options.title = os.path.splitext(os.path.basename(args[0]))[0]
|
||||||
if options.imgproc:
|
if options.imgproc:
|
||||||
print "Processing images..."
|
print "\nProcessing images..."
|
||||||
dirImgProcess(path + "/OEBPS/Images/")
|
dirImgProcess(path + "/OEBPS/Images/")
|
||||||
print "Creating ePub structure..."
|
print "\nCreating ePub structure..."
|
||||||
genEpubStruct(path)
|
genEpubStruct(path)
|
||||||
# actually zip the ePub
|
# actually zip the ePub
|
||||||
if options.output is not None:
|
if options.output is not None:
|
||||||
|
|||||||
10
kcc/gui.py
10
kcc/gui.py
@@ -146,7 +146,7 @@ class MainWindow:
|
|||||||
argv.append("--gamma")
|
argv.append("--gamma")
|
||||||
argv.append(self.options['image_gamma'].get())
|
argv.append(self.options['image_gamma'].get())
|
||||||
if self.options['image_preprocess'].get() == 0:
|
if self.options['image_preprocess'].get() == 0:
|
||||||
argv.append("--no-image-processing")
|
argv.append("--noprocessing")
|
||||||
if self.options['notquantize'].get() == 1:
|
if self.options['notquantize'].get() == 1:
|
||||||
argv.append("--nodithering")
|
argv.append("--nodithering")
|
||||||
if self.options['nosplitrotate'].get() == 1:
|
if self.options['nosplitrotate'].get() == 1:
|
||||||
@@ -154,15 +154,15 @@ class MainWindow:
|
|||||||
if self.options['rotate'].get() == 1:
|
if self.options['rotate'].get() == 1:
|
||||||
argv.append("--rotate")
|
argv.append("--rotate")
|
||||||
if self.options['cut_page_numbers'].get() == 0:
|
if self.options['cut_page_numbers'].get() == 0:
|
||||||
argv.append("--no-cut-page-numbers")
|
argv.append("--nocutpagenumbers")
|
||||||
if self.options['mangastyle'].get() == 1:
|
if self.options['mangastyle'].get() == 1:
|
||||||
argv.append("-m")
|
argv.append("-m")
|
||||||
if self.options['image_upscale'].get() == 1:
|
if self.options['image_upscale'].get() == 1:
|
||||||
argv.append("--upscale-images")
|
argv.append("--upscale")
|
||||||
if self.options['image_stretch'].get() == 1:
|
if self.options['image_stretch'].get() == 1:
|
||||||
argv.append("--stretch-images")
|
argv.append("--stretch")
|
||||||
if self.options['black_borders'].get() == 1:
|
if self.options['black_borders'].get() == 1:
|
||||||
argv.append("--black-borders")
|
argv.append("--blackborders")
|
||||||
errors = False
|
errors = False
|
||||||
left_files = len(self.filelist)
|
left_files = len(self.filelist)
|
||||||
filenum = 0
|
filenum = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user