mirror of
https://github.com/ciromattia/kcc
synced 2025-12-23 14:41:47 +00:00
CLI: Added tool detection
This commit is contained in:
@@ -1081,12 +1081,35 @@ def checkOptions():
|
|||||||
options.profileData = image.ProfileData.Profiles[options.profile]
|
options.profileData = image.ProfileData.Profiles[options.profile]
|
||||||
|
|
||||||
|
|
||||||
|
def checkTools(source):
|
||||||
|
source = source.upper()
|
||||||
|
if source.endswith('.CBR') or source.endswith('.RAR'):
|
||||||
|
rarExitCode = Popen('unrar', stdout=PIPE, stderr=STDOUT, shell=True)
|
||||||
|
rarExitCode = rarExitCode.wait()
|
||||||
|
if rarExitCode != 0 and rarExitCode != 7:
|
||||||
|
print('\nUnRAR is missing!')
|
||||||
|
exit(1)
|
||||||
|
elif source.endswith('.CB7') or source.endswith('.7Z'):
|
||||||
|
sevenzaExitCode = Popen('7za', stdout=PIPE, stderr=STDOUT, shell=True)
|
||||||
|
sevenzaExitCode = sevenzaExitCode.wait()
|
||||||
|
if sevenzaExitCode != 0 and sevenzaExitCode != 7:
|
||||||
|
print('\n7za is missing!')
|
||||||
|
exit(1)
|
||||||
|
if options.format == 'MOBI':
|
||||||
|
kindleGenExitCode = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, shell=True)
|
||||||
|
if kindleGenExitCode.wait() != 0:
|
||||||
|
print('\nKindleGen is missing!')
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
def makeBook(source, qtGUI=None):
|
def makeBook(source, qtGUI=None):
|
||||||
"""Generates MOBI/EPUB/CBZ comic ebook from a bunch of images."""
|
"""Generates MOBI/EPUB/CBZ comic ebook from a bunch of images."""
|
||||||
global GUI
|
global GUI
|
||||||
GUI = qtGUI
|
GUI = qtGUI
|
||||||
if GUI:
|
if GUI:
|
||||||
GUI.progressBarTick.emit('1')
|
GUI.progressBarTick.emit('1')
|
||||||
|
else:
|
||||||
|
checkTools(source)
|
||||||
path = getWorkFolder(source)
|
path = getWorkFolder(source)
|
||||||
print("\nChecking images...")
|
print("\nChecking images...")
|
||||||
getComicInfo(os.path.join(path, "OEBPS", "Images"), source)
|
getComicInfo(os.path.join(path, "OEBPS", "Images"), source)
|
||||||
|
|||||||
Reference in New Issue
Block a user