1
0
mirror of https://github.com/ciromattia/kcc synced 2026-01-12 08:19:51 +00:00

Merge pull request #485 from Constantin1489/master

comic2ebook/func: Add a delete option
This commit is contained in:
darodi
2023-03-02 17:34:16 +01:00
committed by GitHub
2 changed files with 13 additions and 0 deletions

View File

@@ -180,12 +180,16 @@ Options:
page numbers [Default=2]
--cp=CROPPINGP, --croppingpower=CROPPINGP
Set cropping power [Default=1.0]
--cm=CROPPINGM, --croppingminimum=CROPPINGM
Set cropping minimum area ratio [Default=0.0]
--blackborders Disable autodetection and force black borders
--whiteborders Disable autodetection and force white borders
--forcecolor Don't convert images to grayscale
--forcepng Create PNG files instead JPEG
--mozjpeg Create JPEG files using mozJpeg
--maximizestrips Turn 1x4 strips to 2x2 strips
-d, --delete Delete source file(s) or a directory. It's not
recoverable.
CUSTOM PROFILE:
--customwidth=CUSTOMWIDTH

View File

@@ -996,6 +996,9 @@ def makeParser():
help="Create JPEG files using mozJpeg")
processingOptions.add_option("--maximizestrips", action="store_true", dest="maximizestrips", default=False,
help="Turn 1x4 strips to 2x2 strips")
processingOptions.add_option("-d", "--delete", action="store_true", dest="delete", default=False,
help="Delete source file(s) or a directory. It's not recoverable.")
customProfileOptions.add_option("--customwidth", type="int", dest="customwidth", default=0,
help="Replace screen width provided by device profile")
customProfileOptions.add_option("--customheight", type="int", dest="customheight", default=0,
@@ -1225,6 +1228,12 @@ def makeBook(source, qtgui=None):
os.remove(i.replace('.epub', '.mobi') + '_toclean')
if k.path and k.coverSupport:
options.covers[filepath.index(i)][0].saveToKindle(k, options.covers[filepath.index(i)][1])
if options.delete:
if os.path.isfile(source):
os.remove(source)
elif os.path.isdir(source):
rmtree(source)
return filepath