mirror of
https://github.com/ciromattia/kcc
synced 2025-12-22 22:22:21 +00:00
keep epub file when selecting another type of output file
* Keep epub file when selecting another type of output file
This commit is contained in:
@@ -122,7 +122,7 @@ Options:
|
|||||||
Comic title [Default=filename or directory name]
|
Comic title [Default=filename or directory name]
|
||||||
-f FORMAT, --format=FORMAT
|
-f FORMAT, --format=FORMAT
|
||||||
Output format (Available options: Auto, MOBI, EPUB,
|
Output format (Available options: Auto, MOBI, EPUB,
|
||||||
CBZ, KFX) [Default=Auto]
|
CBZ, KFX, MOBI+EPUB, KFX+EPUB) [Default=Auto]
|
||||||
-b BATCHSPLIT, --batchsplit=BATCHSPLIT
|
-b BATCHSPLIT, --batchsplit=BATCHSPLIT
|
||||||
Split output into multiple files. 0: Don't split 1:
|
Split output into multiple files. 0: Don't split 1:
|
||||||
Automatic mode 2: Consider every subdirectory as
|
Automatic mode 2: Consider every subdirectory as
|
||||||
|
|||||||
@@ -116,6 +116,10 @@ class Icons:
|
|||||||
self.EPUBFormat.addPixmap(QtGui.QPixmap(":/Formats/icons/EPUB.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
self.EPUBFormat.addPixmap(QtGui.QPixmap(":/Formats/icons/EPUB.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
self.KFXFormat = QtGui.QIcon()
|
self.KFXFormat = QtGui.QIcon()
|
||||||
self.KFXFormat.addPixmap(QtGui.QPixmap(":/Formats/icons/KFX.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
self.KFXFormat.addPixmap(QtGui.QPixmap(":/Formats/icons/KFX.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
self.MOBIEPUBFormat = QtGui.QIcon()
|
||||||
|
self.MOBIEPUBFormat.addPixmap(QtGui.QPixmap(":/Formats/icons/MOBI.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
self.KFXEPUBFormat = QtGui.QIcon()
|
||||||
|
self.KFXEPUBFormat.addPixmap(QtGui.QPixmap(":/Formats/icons/KFX.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
|
||||||
self.info = QtGui.QIcon()
|
self.info = QtGui.QIcon()
|
||||||
self.info.addPixmap(QtGui.QPixmap(":/Status/icons/info.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
self.info.addPixmap(QtGui.QPixmap(":/Status/icons/info.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
@@ -315,8 +319,7 @@ class WorkerThread(QtCore.QThread):
|
|||||||
jobargv = list(argv)
|
jobargv = list(argv)
|
||||||
jobargv.append(job)
|
jobargv.append(job)
|
||||||
try:
|
try:
|
||||||
comic2ebook.options = copy(options)
|
comic2ebook.options = comic2ebook.checkOptions(copy(options))
|
||||||
comic2ebook.checkOptions()
|
|
||||||
outputPath = comic2ebook.makeBook(job, self)
|
outputPath = comic2ebook.makeBook(job, self)
|
||||||
MW.hideProgressBar.emit()
|
MW.hideProgressBar.emit()
|
||||||
except UserWarning as warn:
|
except UserWarning as warn:
|
||||||
@@ -361,7 +364,7 @@ class WorkerThread(QtCore.QThread):
|
|||||||
MW.addMessage.emit('Creating CBZ files... <b>Done!</b>', 'info', True)
|
MW.addMessage.emit('Creating CBZ files... <b>Done!</b>', 'info', True)
|
||||||
else:
|
else:
|
||||||
MW.addMessage.emit('Creating EPUB files... <b>Done!</b>', 'info', True)
|
MW.addMessage.emit('Creating EPUB files... <b>Done!</b>', 'info', True)
|
||||||
if str(GUI.formatBox.currentText()) == 'MOBI/AZW3':
|
if str(GUI.formatBox.currentText()) == 'MOBI/AZW3' or str(GUI.formatBox.currentText()) == 'MOBI+EPUB':
|
||||||
MW.progressBarTick.emit('Creating MOBI files')
|
MW.progressBarTick.emit('Creating MOBI files')
|
||||||
MW.progressBarTick.emit(str(len(outputPath) * 2 + 1))
|
MW.progressBarTick.emit(str(len(outputPath) * 2 + 1))
|
||||||
MW.progressBarTick.emit('tick')
|
MW.progressBarTick.emit('tick')
|
||||||
@@ -1064,8 +1067,8 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
|||||||
GUI.deviceBox.addItem(self.icons.deviceKobo, profile)
|
GUI.deviceBox.addItem(self.icons.deviceKobo, profile)
|
||||||
else:
|
else:
|
||||||
GUI.deviceBox.addItem(self.icons.deviceKindle, profile)
|
GUI.deviceBox.addItem(self.icons.deviceKindle, profile)
|
||||||
for f in ['MOBI/AZW3', 'EPUB', 'CBZ', 'KFX']:
|
for f in ['MOBI/AZW3', 'EPUB', 'CBZ', 'KFX', 'MOBI+EPUB', 'KFX+EPUB']:
|
||||||
GUI.formatBox.addItem(eval('self.icons.' + f.replace('/AZW3', '') + 'Format'), f)
|
GUI.formatBox.addItem(eval('self.icons.' + f.replace('/AZW3', '').replace('+', '') + 'Format'), f)
|
||||||
if self.lastDevice > GUI.deviceBox.count():
|
if self.lastDevice > GUI.deviceBox.count():
|
||||||
self.lastDevice = 0
|
self.lastDevice = 0
|
||||||
if profilesGUI[self.lastDevice] == "Separator":
|
if profilesGUI[self.lastDevice] == "Separator":
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ def main(argv=None):
|
|||||||
for source in sources:
|
for source in sources:
|
||||||
source = source.rstrip('\\').rstrip('/')
|
source = source.rstrip('\\').rstrip('/')
|
||||||
options = copy(optionstemplate)
|
options = copy(optionstemplate)
|
||||||
checkOptions()
|
options = checkOptions(options)
|
||||||
if len(sources) > 1:
|
if len(sources) > 1:
|
||||||
print('Working on ' + source + '...')
|
print('Working on ' + source + '...')
|
||||||
makeBook(source)
|
makeBook(source)
|
||||||
@@ -925,7 +925,8 @@ def makeParser():
|
|||||||
outputOptions.add_option("-t", "--title", action="store", dest="title", default="defaulttitle",
|
outputOptions.add_option("-t", "--title", action="store", dest="title", default="defaulttitle",
|
||||||
help="Comic title [Default=filename or directory name]")
|
help="Comic title [Default=filename or directory name]")
|
||||||
outputOptions.add_option("-f", "--format", action="store", dest="format", default="Auto",
|
outputOptions.add_option("-f", "--format", action="store", dest="format", default="Auto",
|
||||||
help="Output format (Available options: Auto, MOBI, EPUB, CBZ, KFX) [Default=Auto]")
|
help="Output format (Available options: Auto, MOBI, EPUB, CBZ, KFX, MOBI+EPUB, KFX+EPUB) "
|
||||||
|
"[Default=Auto]")
|
||||||
outputOptions.add_option("-b", "--batchsplit", type="int", dest="batchsplit", default="0",
|
outputOptions.add_option("-b", "--batchsplit", type="int", dest="batchsplit", default="0",
|
||||||
help="Split output into multiple files. 0: Don't split 1: Automatic mode "
|
help="Split output into multiple files. 0: Don't split 1: Automatic mode "
|
||||||
"2: Consider every subdirectory as separate volume [Default=0]")
|
"2: Consider every subdirectory as separate volume [Default=0]")
|
||||||
@@ -972,11 +973,17 @@ def makeParser():
|
|||||||
return psr
|
return psr
|
||||||
|
|
||||||
|
|
||||||
def checkOptions():
|
def checkOptions(options):
|
||||||
global options
|
|
||||||
options.panelview = True
|
options.panelview = True
|
||||||
options.iskindle = False
|
options.iskindle = False
|
||||||
options.bordersColor = None
|
options.bordersColor = None
|
||||||
|
options.keep_epub = False
|
||||||
|
if options.format == 'MOBI+EPUB':
|
||||||
|
options.keep_epub = True
|
||||||
|
options.format = 'MOBI'
|
||||||
|
if options.format == 'KFX+EPUB':
|
||||||
|
options.keep_epub = True
|
||||||
|
options.format = 'KFX'
|
||||||
options.kfx = False
|
options.kfx = False
|
||||||
if options.format == 'Auto':
|
if options.format == 'Auto':
|
||||||
if options.profile in ['K1', 'K2', 'K34', 'K578', 'KPW', 'KPW5', 'KV', 'KO']:
|
if options.profile in ['K1', 'K2', 'K34', 'K578', 'KPW', 'KPW5', 'KV', 'KO']:
|
||||||
@@ -1032,6 +1039,7 @@ def checkOptions():
|
|||||||
image.ProfileData.Profiles["Custom"] = newProfile
|
image.ProfileData.Profiles["Custom"] = newProfile
|
||||||
options.profile = "Custom"
|
options.profile = "Custom"
|
||||||
options.profileData = image.ProfileData.Profiles[options.profile]
|
options.profileData = image.ProfileData.Profiles[options.profile]
|
||||||
|
return options
|
||||||
|
|
||||||
|
|
||||||
def checkTools(source):
|
def checkTools(source):
|
||||||
@@ -1166,6 +1174,7 @@ def makeBook(source, qtgui=None):
|
|||||||
|
|
||||||
|
|
||||||
def makeMOBIFix(item, uuid):
|
def makeMOBIFix(item, uuid):
|
||||||
|
if not options.keep_epub:
|
||||||
os.remove(item)
|
os.remove(item)
|
||||||
mobiPath = item.replace('.epub', '.mobi')
|
mobiPath = item.replace('.epub', '.mobi')
|
||||||
move(mobiPath, mobiPath + '_toclean')
|
move(mobiPath, mobiPath + '_toclean')
|
||||||
|
|||||||
Reference in New Issue
Block a user