mirror of
https://github.com/ciromattia/kcc
synced 2026-02-05 20:02:08 +00:00
Add --prefercoverfile and --nocoveraspage arguments to CLI
This commit is contained in:
@@ -501,15 +501,28 @@ def buildEPUB(path, chapternames, tomenumber):
|
||||
chapter = False
|
||||
dirnames, filenames = walkSort(dirnames, filenames)
|
||||
for afile in filenames:
|
||||
if options.coverfile:
|
||||
if (getImageFileName(afile)[0] == 'cover-kcc'):
|
||||
if (os.path.isfile(os.path.join(dirpath, 'cover-kcc' + getImageFileName(afile)[1]))):
|
||||
cover = os.path.join(os.path.join(path, 'OEBPS', 'Images'),
|
||||
'cover' + getImageFileName(afile)[1])
|
||||
options.covers.append((image.Cover(os.path.join(dirpath, afile),
|
||||
cover, options, tomenumber), options.uuid))
|
||||
if options.coverpage:
|
||||
os.remove(os.path.join(dirpath, afile))
|
||||
continue
|
||||
elif cover is None:
|
||||
cover = os.path.join(os.path.join(path, 'OEBPS', 'Images'),
|
||||
'cover' + getImageFileName(afile)[1])
|
||||
options.covers.append((image.Cover(os.path.join(dirpath, afile), cover, options,
|
||||
tomenumber), options.uuid))
|
||||
if options.coverpage:
|
||||
os.remove(os.path.join(dirpath, afile))
|
||||
continue
|
||||
filelist.append(buildHTML(dirpath, afile, os.path.join(dirpath, afile)))
|
||||
if not chapter:
|
||||
chapterlist.append((dirpath.replace('Images', 'Text'), filelist[-1][1]))
|
||||
chapter = True
|
||||
if cover is None:
|
||||
cover = os.path.join(os.path.join(path, 'OEBPS', 'Images'),
|
||||
'cover' + getImageFileName(filelist[-1][1])[1])
|
||||
options.covers.append((image.Cover(os.path.join(filelist[-1][0], filelist[-1][1]), cover, options,
|
||||
tomenumber), options.uuid))
|
||||
# Overwrite chapternames if tree is flat and ComicInfo.xml has bookmarks
|
||||
if not chapternames and options.chapters:
|
||||
chapterlist = []
|
||||
@@ -676,7 +689,6 @@ def getOutputFilename(srcpath, wantedname, ext, tomenumber):
|
||||
|
||||
def getComicInfo(path, originalpath):
|
||||
xmlPath = os.path.join(path, 'ComicInfo.xml')
|
||||
options.authors = ['KCC']
|
||||
options.chapters = []
|
||||
options.summary = ''
|
||||
titleSuffix = ''
|
||||
@@ -983,6 +995,10 @@ def makeParser():
|
||||
output_options.add_argument("-b", "--batchsplit", type=int, dest="batchsplit", default="0",
|
||||
help="Split output into multiple files. 0: Don't split 1: Automatic mode "
|
||||
"2: Consider every subdirectory as separate volume [Default=0]")
|
||||
output_options.add_argument("--prefercoverfile", action="store_true", dest="coverfile", default=False,
|
||||
help="Use cover.jpeg as cover if it exists")
|
||||
output_options.add_argument("--nocoveraspage", action="store_true", dest="coverpage", default=False,
|
||||
help="Don't create a page for the cover inside the book")
|
||||
|
||||
processing_options.add_argument("-n", "--noprocessing", action="store_true", dest="noprocessing", default=False,
|
||||
help="Do not modify image and ignore any profil or processing option")
|
||||
|
||||
Reference in New Issue
Block a user