mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 01:36:27 +00:00
Adds --author argument to CLI (#683)
This commit is contained in:
@@ -689,7 +689,6 @@ def getOutputFilename(srcpath, wantedname, ext, tomenumber):
|
|||||||
|
|
||||||
def getComicInfo(path, originalpath):
|
def getComicInfo(path, originalpath):
|
||||||
xmlPath = os.path.join(path, 'ComicInfo.xml')
|
xmlPath = os.path.join(path, 'ComicInfo.xml')
|
||||||
options.authors = ['KCC']
|
|
||||||
options.chapters = []
|
options.chapters = []
|
||||||
options.summary = ''
|
options.summary = ''
|
||||||
titleSuffix = ''
|
titleSuffix = ''
|
||||||
@@ -701,13 +700,18 @@ def getComicInfo(path, originalpath):
|
|||||||
options.title = os.path.splitext(os.path.basename(originalpath))[0]
|
options.title = os.path.splitext(os.path.basename(originalpath))[0]
|
||||||
else:
|
else:
|
||||||
defaultTitle = False
|
defaultTitle = False
|
||||||
|
if options.author == 'defaultauthor':
|
||||||
|
defaultAuthor = True
|
||||||
|
options.authors = ['KCC']
|
||||||
|
else:
|
||||||
|
defaultAuthor = False
|
||||||
|
options.authors = [options.author]
|
||||||
if os.path.exists(xmlPath):
|
if os.path.exists(xmlPath):
|
||||||
try:
|
try:
|
||||||
xml = metadata.MetadataParser(xmlPath)
|
xml = metadata.MetadataParser(xmlPath)
|
||||||
except Exception:
|
except Exception:
|
||||||
os.remove(xmlPath)
|
os.remove(xmlPath)
|
||||||
return
|
return
|
||||||
options.authors = []
|
|
||||||
if xml.data['Title']:
|
if xml.data['Title']:
|
||||||
options.title = hescape(xml.data['Title'])
|
options.title = hescape(xml.data['Title'])
|
||||||
elif defaultTitle:
|
elif defaultTitle:
|
||||||
@@ -718,14 +722,16 @@ def getComicInfo(path, originalpath):
|
|||||||
if xml.data['Number']:
|
if xml.data['Number']:
|
||||||
titleSuffix += ' #' + xml.data['Number'].zfill(3)
|
titleSuffix += ' #' + xml.data['Number'].zfill(3)
|
||||||
options.title += titleSuffix
|
options.title += titleSuffix
|
||||||
for field in ['Writers', 'Pencillers', 'Inkers', 'Colorists']:
|
if defaultAuthor:
|
||||||
for person in xml.data[field]:
|
options.authors = []
|
||||||
options.authors.append(hescape(person))
|
for field in ['Writers', 'Pencillers', 'Inkers', 'Colorists']:
|
||||||
if len(options.authors) > 0:
|
for person in xml.data[field]:
|
||||||
options.authors = list(set(options.authors))
|
options.authors.append(hescape(person))
|
||||||
options.authors.sort()
|
if len(options.authors) > 0:
|
||||||
else:
|
options.authors = list(set(options.authors))
|
||||||
options.authors = ['KCC']
|
options.authors.sort()
|
||||||
|
else:
|
||||||
|
options.authors = ['KCC']
|
||||||
if xml.data['Bookmarks'] and options.batchsplit == 0:
|
if xml.data['Bookmarks'] and options.batchsplit == 0:
|
||||||
options.chapters = xml.data['Bookmarks']
|
options.chapters = xml.data['Bookmarks']
|
||||||
if xml.data['Summary']:
|
if xml.data['Summary']:
|
||||||
@@ -964,6 +970,8 @@ def makeParser():
|
|||||||
help="Output generated file to specified directory or file")
|
help="Output generated file to specified directory or file")
|
||||||
output_options.add_argument("-t", "--title", action="store", dest="title", default="defaulttitle",
|
output_options.add_argument("-t", "--title", action="store", dest="title", default="defaulttitle",
|
||||||
help="Comic title [Default=filename or directory name]")
|
help="Comic title [Default=filename or directory name]")
|
||||||
|
output_options.add_argument("-a", "--author", action="store", dest="author", default="defaultauthor",
|
||||||
|
help="Author name [Default=KCC]")
|
||||||
output_options.add_argument("-f", "--format", action="store", dest="format", default="Auto",
|
output_options.add_argument("-f", "--format", action="store", dest="format", default="Auto",
|
||||||
help="Output format (Available options: Auto, MOBI, EPUB, CBZ, KFX, MOBI+EPUB) "
|
help="Output format (Available options: Auto, MOBI, EPUB, CBZ, KFX, MOBI+EPUB) "
|
||||||
"[Default=Auto]")
|
"[Default=Auto]")
|
||||||
|
|||||||
Reference in New Issue
Block a user