mirror of
https://github.com/ciromattia/kcc
synced 2025-12-25 07:31:52 +00:00
Miscellaneous processing tweaks
This commit is contained in:
@@ -386,7 +386,7 @@
|
|||||||
<enum>Qt::NoFocus</enum>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Unchecked - Normal quality mode<br/></span><span style=" font-style:italic;">Use it when zoom is not needed.<br/></span>Overall quality: ★★★★★<br/>Zoom quality: ★<br/>File size: ★</p><p><span style=" font-weight:600; text-decoration: underline;">Indeterminate - High quality mode<br/></span><span style=" font-style:italic;">A compromise between quality and size.<br/></span>Overall quality: ★★★★<br/>Zoom quality: ★★★<br/>File size: ★★★<br/></p><p><span style=" font-weight:600; text-decoration: underline;">Checked - Ultra quality mode<br/></span><span style=" font-style:italic;">Highest possible quality. Recommended.<br/></span>Overall quality: ★★★★★<br/>Zoom quality: ★★★★★<br/>File size: ★★★★★</p></body></html></string>
|
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Unchecked - Normal quality mode</span><br/>Maximal quality of images but very poor magnification quality.<br/>Use it only when zoom is not needed or output files needs to be small.</p><p><span style=" font-weight:600; text-decoration: underline;">Indeterminate - High quality mode</span><br/>In most cases high quality of images and magnification.<br/>Overall quality highly depends on the resolution of source files.<br/>On Kindle models older than Paperwhite non-zoomed images might be a little blurred.<br/><br/><span style=" font-weight:600; text-decoration: underline;">Checked - Ultra quality mode</span><br/>Highest possible quality. Output files will be big.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>High/Ultra quality</string>
|
<string>High/Ultra quality</string>
|
||||||
|
|||||||
@@ -391,7 +391,7 @@
|
|||||||
<enum>Qt::NoFocus</enum>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Unchecked - Normal quality mode</span><br/><span style=" font-style:italic;">Use it when zoom is not needed.</span><br/>Overall quality: ★★★★★<br/>Zoom quality: ★<br/>File size: ★<br/><br/><span style=" font-weight:600; text-decoration: underline;">Indeterminate - High quality mode</span><br/><span style=" font-style:italic;">A compromise between quality and size.</span><br/>Overall quality: ★★★★<br/>Zoom quality: ★★★<br/>File size: ★★★<br/><br/><span style=" font-weight:600; text-decoration: underline;">Checked - Ultra quality mode</span><br/><span style=" font-style:italic;">Highest possible quality. Recommended.</span><br/>Overall quality: ★★★★★<br/>Zoom quality: ★★★★★<br/>File size: ★★★★★</p></body></html></string>
|
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Unchecked - Normal quality mode</span><br/>Maximal quality of images but very poor magnification quality.<br/>Use it only when zoom is not needed or output files needs to be small.</p><p><span style=" font-weight:600; text-decoration: underline;">Indeterminate - High quality mode</span><br/>In most cases high quality of images and magnification.<br/>Overall quality highly depends on the resolution of source files.<br/>On Kindle models older than Paperwhite non-zoomed images might be a little blurred.</p><p><span style=" font-weight:600; text-decoration: underline;">Checked - Ultra quality mode</span><br/>Highest possible quality. Output files will be big.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>High/Ultra quality</string>
|
<string>High/Ultra quality</string>
|
||||||
|
|||||||
2
KCC.ui
2
KCC.ui
@@ -338,7 +338,7 @@
|
|||||||
<enum>Qt::NoFocus</enum>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Unchecked - Normal quality mode<br/></span><span style=" font-style:italic;">Use it when zoom is not needed.</span><span style=" font-weight:600; text-decoration: underline;"><br/></span>Overall quality: ★★★★★<br/>Zoom quality: ★<br/>File size: ★</p><p><span style=" font-weight:600; text-decoration: underline;">Indeterminate - High quality mode<br/></span><span style=" font-style:italic;">A compromise between quality and size.</span><span style=" font-weight:600; text-decoration: underline;"><br/></span>Overall quality: ★★★★<br/>Zoom quality: ★★★<br/>File size: ★★★</p><p><span style=" font-weight:600; text-decoration: underline;">Checked - Ultra quality mode<br/></span><span style=" font-style:italic;">Highest possible quality. Recommended.</span><span style=" font-weight:600; text-decoration: underline;"><br/></span>Overall quality: ★★★★★<br/>Zoom quality: ★★★★★<br/>File size: ★★★★★</p></body></html></string>
|
<string><html><head/><body><p style="white-space:pre"><span style=" font-weight:600; text-decoration: underline;">Unchecked - Normal quality mode<br/></span>Maximal quality of images but very poor magnification quality.<br/>Use it only when zoom is not needed or output files needs to be small.</p><p style="white-space:pre"><span style=" font-weight:600; text-decoration: underline;">Indeterminate - High quality mode<br/></span>In most cases high quality of images and magnification.<br/>Overall quality highly depends on the resolution of source files.<br/>On Kindle models older than Paperwhite non-zoomed images might be a little blurred.</p><p style="white-space:pre"><span style=" font-weight:600; text-decoration: underline;">Checked - Ultra quality mode<br/></span>Highest possible quality. Output files will be big.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>High/Ultra quality</string>
|
<string>High/Ultra quality</string>
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ class KindleGenThread(QtCore.QRunnable):
|
|||||||
kindlegenErrorCode = 0
|
kindlegenErrorCode = 0
|
||||||
kindlegenError = ''
|
kindlegenError = ''
|
||||||
try:
|
try:
|
||||||
if os.path.getsize(self.work) < 367001600:
|
if os.path.getsize(self.work) < 629145600:
|
||||||
output = Popen('kindlegen -dont_append_source -locale en "' + self.work + '"', stdout=PIPE,
|
output = Popen('kindlegen -dont_append_source -locale en "' + self.work + '"', stdout=PIPE,
|
||||||
stderr=STDOUT, shell=True)
|
stderr=STDOUT, shell=True)
|
||||||
for line in output.stdout:
|
for line in output.stdout:
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'KCC.ui'
|
# Form implementation generated from reading ui file 'KCC.ui'
|
||||||
#
|
#
|
||||||
# Created: Thu May 15 19:36:32 2014
|
# Created: Sun May 18 09:08:27 2014
|
||||||
# by: PyQt5 UI code generator 5.2.1
|
# by: PyQt5 UI code generator 5.2.1
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
@@ -281,7 +281,7 @@ class Ui_KCC(object):
|
|||||||
self.ClearButton.setText(_translate("KCC", "Clear list"))
|
self.ClearButton.setText(_translate("KCC", "Clear list"))
|
||||||
self.MangaBox.setToolTip(_translate("KCC", "<html><head/><body><p style=\'white-space:pre\'>Enable right-to-left reading.</p></body></html>"))
|
self.MangaBox.setToolTip(_translate("KCC", "<html><head/><body><p style=\'white-space:pre\'>Enable right-to-left reading.</p></body></html>"))
|
||||||
self.MangaBox.setText(_translate("KCC", "Manga mode"))
|
self.MangaBox.setText(_translate("KCC", "Manga mode"))
|
||||||
self.QualityBox.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-weight:600; text-decoration: underline;\">Unchecked - Normal quality mode<br/></span><span style=\" font-style:italic;\">Use it when zoom is not needed.</span><span style=\" font-weight:600; text-decoration: underline;\"><br/></span>Overall quality: ★★★★★<br/>Zoom quality: ★<br/>File size: ★</p><p><span style=\" font-weight:600; text-decoration: underline;\">Indeterminate - High quality mode<br/></span><span style=\" font-style:italic;\">A compromise between quality and size.</span><span style=\" font-weight:600; text-decoration: underline;\"><br/></span>Overall quality: ★★★★<br/>Zoom quality: ★★★<br/>File size: ★★★</p><p><span style=\" font-weight:600; text-decoration: underline;\">Checked - Ultra quality mode<br/></span><span style=\" font-style:italic;\">Highest possible quality. Recommended.</span><span style=\" font-weight:600; text-decoration: underline;\"><br/></span>Overall quality: ★★★★★<br/>Zoom quality: ★★★★★<br/>File size: ★★★★★</p></body></html>"))
|
self.QualityBox.setToolTip(_translate("KCC", "<html><head/><body><p style=\"white-space:pre\"><span style=\" font-weight:600; text-decoration: underline;\">Unchecked - Normal quality mode<br/></span>Maximal quality of images but very poor magnification quality.<br/>Use it only when zoom is not needed or output files needs to be small.</p><p style=\"white-space:pre\"><span style=\" font-weight:600; text-decoration: underline;\">Indeterminate - High quality mode<br/></span>In most cases high quality of images and magnification.<br/>Overall quality highly depends on the resolution of source files.<br/>On Kindle models older than Paperwhite non-zoomed images might be a little blurred.</p><p style=\"white-space:pre\"><span style=\" font-weight:600; text-decoration: underline;\">Checked - Ultra quality mode<br/></span>Highest possible quality. Output files will be big.</p></body></html>"))
|
||||||
self.QualityBox.setText(_translate("KCC", "High/Ultra quality"))
|
self.QualityBox.setText(_translate("KCC", "High/Ultra quality"))
|
||||||
self.RotateBox.setToolTip(_translate("KCC", "<html><head/><body><p style=\'white-space:pre\'>Disable splitting of two-page spreads.<br/>They will be rotated instead.</p></body></html>"))
|
self.RotateBox.setToolTip(_translate("KCC", "<html><head/><body><p style=\'white-space:pre\'>Disable splitting of two-page spreads.<br/>They will be rotated instead.</p></body></html>"))
|
||||||
self.RotateBox.setText(_translate("KCC", "Horizontal mode"))
|
self.RotateBox.setText(_translate("KCC", "Horizontal mode"))
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'KCC-Linux.ui'
|
# Form implementation generated from reading ui file 'KCC-Linux.ui'
|
||||||
#
|
#
|
||||||
# Created: Thu May 15 19:36:41 2014
|
# Created: Sun May 18 09:08:37 2014
|
||||||
# by: PyQt5 UI code generator 5.2.1
|
# by: PyQt5 UI code generator 5.2.1
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
@@ -350,7 +350,7 @@ class Ui_KCC(object):
|
|||||||
self.ClearButton.setText(_translate("KCC", "Clear list"))
|
self.ClearButton.setText(_translate("KCC", "Clear list"))
|
||||||
self.MangaBox.setToolTip(_translate("KCC", "<html><head/><body><p style=\'white-space:pre\'>Enable right-to-left reading.</p></body></html>"))
|
self.MangaBox.setToolTip(_translate("KCC", "<html><head/><body><p style=\'white-space:pre\'>Enable right-to-left reading.</p></body></html>"))
|
||||||
self.MangaBox.setText(_translate("KCC", "Manga mode"))
|
self.MangaBox.setText(_translate("KCC", "Manga mode"))
|
||||||
self.QualityBox.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-weight:600; text-decoration: underline;\">Unchecked - Normal quality mode<br/></span><span style=\" font-style:italic;\">Use it when zoom is not needed.<br/></span>Overall quality: ★★★★★<br/>Zoom quality: ★<br/>File size: ★</p><p><span style=\" font-weight:600; text-decoration: underline;\">Indeterminate - High quality mode<br/></span><span style=\" font-style:italic;\">A compromise between quality and size.<br/></span>Overall quality: ★★★★<br/>Zoom quality: ★★★<br/>File size: ★★★<br/></p><p><span style=\" font-weight:600; text-decoration: underline;\">Checked - Ultra quality mode<br/></span><span style=\" font-style:italic;\">Highest possible quality. Recommended.<br/></span>Overall quality: ★★★★★<br/>Zoom quality: ★★★★★<br/>File size: ★★★★★</p></body></html>"))
|
self.QualityBox.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-weight:600; text-decoration: underline;\">Unchecked - Normal quality mode</span><br/>Maximal quality of images but very poor magnification quality.<br/>Use it only when zoom is not needed or output files needs to be small.</p><p><span style=\" font-weight:600; text-decoration: underline;\">Indeterminate - High quality mode</span><br/>In most cases high quality of images and magnification.<br/>Overall quality highly depends on the resolution of source files.<br/>On Kindle models older than Paperwhite non-zoomed images might be a little blurred.<br/><br/><span style=\" font-weight:600; text-decoration: underline;\">Checked - Ultra quality mode</span><br/>Highest possible quality. Output files will be big.</p></body></html>"))
|
||||||
self.QualityBox.setText(_translate("KCC", "High/Ultra quality"))
|
self.QualityBox.setText(_translate("KCC", "High/Ultra quality"))
|
||||||
self.RotateBox.setToolTip(_translate("KCC", "<html><head/><body><p style=\'white-space:pre\'>Disable splitting of two-page spreads.<br/>They will be rotated instead.</p></body></html>"))
|
self.RotateBox.setToolTip(_translate("KCC", "<html><head/><body><p style=\'white-space:pre\'>Disable splitting of two-page spreads.<br/>They will be rotated instead.</p></body></html>"))
|
||||||
self.RotateBox.setText(_translate("KCC", "Horizontal mode"))
|
self.RotateBox.setText(_translate("KCC", "Horizontal mode"))
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'KCC-OSX.ui'
|
# Form implementation generated from reading ui file 'KCC-OSX.ui'
|
||||||
#
|
#
|
||||||
# Created: Thu May 15 19:36:50 2014
|
# Created: Sun May 18 09:08:44 2014
|
||||||
# by: PyQt5 UI code generator 5.2.1
|
# by: PyQt5 UI code generator 5.2.1
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
@@ -373,7 +373,7 @@ class Ui_KCC(object):
|
|||||||
self.ClearButton.setText(_translate("KCC", "Clear list"))
|
self.ClearButton.setText(_translate("KCC", "Clear list"))
|
||||||
self.MangaBox.setToolTip(_translate("KCC", "<html><head/><body><p style=\'white-space:pre\'>Enable right-to-left reading.</p></body></html>"))
|
self.MangaBox.setToolTip(_translate("KCC", "<html><head/><body><p style=\'white-space:pre\'>Enable right-to-left reading.</p></body></html>"))
|
||||||
self.MangaBox.setText(_translate("KCC", "Manga mode"))
|
self.MangaBox.setText(_translate("KCC", "Manga mode"))
|
||||||
self.QualityBox.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-weight:600; text-decoration: underline;\">Unchecked - Normal quality mode</span><br/><span style=\" font-style:italic;\">Use it when zoom is not needed.</span><br/>Overall quality: ★★★★★<br/>Zoom quality: ★<br/>File size: ★<br/><br/><span style=\" font-weight:600; text-decoration: underline;\">Indeterminate - High quality mode</span><br/><span style=\" font-style:italic;\">A compromise between quality and size.</span><br/>Overall quality: ★★★★<br/>Zoom quality: ★★★<br/>File size: ★★★<br/><br/><span style=\" font-weight:600; text-decoration: underline;\">Checked - Ultra quality mode</span><br/><span style=\" font-style:italic;\">Highest possible quality. Recommended.</span><br/>Overall quality: ★★★★★<br/>Zoom quality: ★★★★★<br/>File size: ★★★★★</p></body></html>"))
|
self.QualityBox.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-weight:600; text-decoration: underline;\">Unchecked - Normal quality mode</span><br/>Maximal quality of images but very poor magnification quality.<br/>Use it only when zoom is not needed or output files needs to be small.</p><p><span style=\" font-weight:600; text-decoration: underline;\">Indeterminate - High quality mode</span><br/>In most cases high quality of images and magnification.<br/>Overall quality highly depends on the resolution of source files.<br/>On Kindle models older than Paperwhite non-zoomed images might be a little blurred.</p><p><span style=\" font-weight:600; text-decoration: underline;\">Checked - Ultra quality mode</span><br/>Highest possible quality. Output files will be big.</p></body></html>"))
|
||||||
self.QualityBox.setText(_translate("KCC", "High/Ultra quality"))
|
self.QualityBox.setText(_translate("KCC", "High/Ultra quality"))
|
||||||
self.RotateBox.setToolTip(_translate("KCC", "<html><head/><body><p style=\'white-space:pre\'>Disable splitting of two-page spreads.<br/>They will be rotated instead.</p></body></html>"))
|
self.RotateBox.setToolTip(_translate("KCC", "<html><head/><body><p style=\'white-space:pre\'>Disable splitting of two-page spreads.<br/>They will be rotated instead.</p></body></html>"))
|
||||||
self.RotateBox.setText(_translate("KCC", "Horizontal mode"))
|
self.RotateBox.setText(_translate("KCC", "Horizontal mode"))
|
||||||
|
|||||||
@@ -231,7 +231,10 @@ def buildNCX(dstdir, title, chapters, chapterNames):
|
|||||||
def buildOPF(dstdir, title, filelist, cover=None):
|
def buildOPF(dstdir, title, filelist, cover=None):
|
||||||
opffile = os.path.join(dstdir, 'OEBPS', 'content.opf')
|
opffile = os.path.join(dstdir, 'OEBPS', 'content.opf')
|
||||||
profilelabel, deviceres, palette, gamma, panelviewsize = options.profileData
|
profilelabel, deviceres, palette, gamma, panelviewsize = options.profileData
|
||||||
imgres = str(deviceres[0]) + "x" + str(deviceres[1])
|
if options.quality == 1:
|
||||||
|
imgres = str(panelviewsize[0]) + "x" + str(panelviewsize[1])
|
||||||
|
else:
|
||||||
|
imgres = str(deviceres[0]) + "x" + str(deviceres[1])
|
||||||
if options.righttoleft:
|
if options.righttoleft:
|
||||||
writingmode = "horizontal-rl"
|
writingmode = "horizontal-rl"
|
||||||
else:
|
else:
|
||||||
@@ -729,7 +732,7 @@ def splitDirectory(path, mode):
|
|||||||
for root, dirs, files in walkLevel(path, 0):
|
for root, dirs, files in walkLevel(path, 0):
|
||||||
for name in files:
|
for name in files:
|
||||||
size = os.path.getsize(os.path.join(root, name))
|
size = os.path.getsize(os.path.join(root, name))
|
||||||
if currentSize + size > 314572800:
|
if currentSize + size > 419430400:
|
||||||
currentTarget, pathRoot = createNewTome()
|
currentTarget, pathRoot = createNewTome()
|
||||||
output.append(pathRoot)
|
output.append(pathRoot)
|
||||||
currentSize = size
|
currentSize = size
|
||||||
@@ -741,7 +744,7 @@ def splitDirectory(path, mode):
|
|||||||
for root, dirs, files in walkLevel(path, 0):
|
for root, dirs, files in walkLevel(path, 0):
|
||||||
for name in dirs:
|
for name in dirs:
|
||||||
size = getDirectorySize(os.path.join(root, name))
|
size = getDirectorySize(os.path.join(root, name))
|
||||||
if currentSize + size > 314572800:
|
if currentSize + size > 419430400:
|
||||||
currentTarget, pathRoot = createNewTome()
|
currentTarget, pathRoot = createNewTome()
|
||||||
output.append(pathRoot)
|
output.append(pathRoot)
|
||||||
currentSize = size
|
currentSize = size
|
||||||
@@ -755,7 +758,7 @@ def splitDirectory(path, mode):
|
|||||||
for name in dirs:
|
for name in dirs:
|
||||||
size = getDirectorySize(os.path.join(root, name))
|
size = getDirectorySize(os.path.join(root, name))
|
||||||
currentSize = 0
|
currentSize = 0
|
||||||
if size > 314572800:
|
if size > 419430400:
|
||||||
if not firstTome:
|
if not firstTome:
|
||||||
currentTarget, pathRoot = createNewTome()
|
currentTarget, pathRoot = createNewTome()
|
||||||
output.append(pathRoot)
|
output.append(pathRoot)
|
||||||
@@ -764,7 +767,7 @@ def splitDirectory(path, mode):
|
|||||||
for rootInside, dirsInside, filesInside in walkLevel(os.path.join(root, name), 0):
|
for rootInside, dirsInside, filesInside in walkLevel(os.path.join(root, name), 0):
|
||||||
for nameInside in dirsInside:
|
for nameInside in dirsInside:
|
||||||
size = getDirectorySize(os.path.join(rootInside, nameInside))
|
size = getDirectorySize(os.path.join(rootInside, nameInside))
|
||||||
if currentSize + size > 314572800:
|
if currentSize + size > 419430400:
|
||||||
currentTarget, pathRoot = createNewTome()
|
currentTarget, pathRoot = createNewTome()
|
||||||
output.append(pathRoot)
|
output.append(pathRoot)
|
||||||
currentSize = size
|
currentSize = size
|
||||||
@@ -784,65 +787,61 @@ def splitDirectory(path, mode):
|
|||||||
|
|
||||||
#noinspection PyUnboundLocalVariable
|
#noinspection PyUnboundLocalVariable
|
||||||
def preSplitDirectory(path):
|
def preSplitDirectory(path):
|
||||||
if getDirectorySize(os.path.join(path, 'OEBPS', 'Images')) > 314572800:
|
# Detect directory stucture
|
||||||
# Detect directory stucture
|
for root, dirs, files in walkLevel(os.path.join(path, 'OEBPS', 'Images'), 0):
|
||||||
for root, dirs, files in walkLevel(os.path.join(path, 'OEBPS', 'Images'), 0):
|
subdirectoryNumber = len(dirs)
|
||||||
subdirectoryNumber = len(dirs)
|
filesNumber = len(files)
|
||||||
filesNumber = len(files)
|
if subdirectoryNumber == 0:
|
||||||
if subdirectoryNumber == 0:
|
# No subdirectories
|
||||||
# No subdirectories
|
mode = 0
|
||||||
mode = 0
|
|
||||||
else:
|
|
||||||
if filesNumber > 0:
|
|
||||||
print('\nWARNING: Automatic output splitting failed.')
|
|
||||||
if GUI:
|
|
||||||
GUI.addMessage.emit('Automatic output splitting failed. <a href='
|
|
||||||
'"https://github.com/ciromattia/kcc/wiki'
|
|
||||||
'/Automatic-output-splitting">'
|
|
||||||
'More details.</a>', 'warning', False)
|
|
||||||
GUI.addMessage.emit('', '', False)
|
|
||||||
return [path]
|
|
||||||
detectedSubSubdirectories = False
|
|
||||||
detectedFilesInSubdirectories = False
|
|
||||||
for root, dirs, files in walkLevel(os.path.join(path, 'OEBPS', 'Images'), 1):
|
|
||||||
if root != os.path.join(path, 'OEBPS', 'Images'):
|
|
||||||
if len(dirs) != 0:
|
|
||||||
detectedSubSubdirectories = True
|
|
||||||
elif len(dirs) == 0 and detectedSubSubdirectories:
|
|
||||||
print('\nWARNING: Automatic output splitting failed.')
|
|
||||||
if GUI:
|
|
||||||
GUI.addMessage.emit('Automatic output splitting failed. <a href='
|
|
||||||
'"https://github.com/ciromattia/kcc/wiki'
|
|
||||||
'/Automatic-output-splitting">'
|
|
||||||
'More details.</a>', 'warning', False)
|
|
||||||
GUI.addMessage.emit('', '', False)
|
|
||||||
return [path]
|
|
||||||
if len(files) != 0:
|
|
||||||
detectedFilesInSubdirectories = True
|
|
||||||
if detectedSubSubdirectories:
|
|
||||||
# Two levels of subdirectories
|
|
||||||
mode = 2
|
|
||||||
else:
|
|
||||||
# One level of subdirectories
|
|
||||||
mode = 1
|
|
||||||
if detectedFilesInSubdirectories and detectedSubSubdirectories:
|
|
||||||
print('\nWARNING: Automatic output splitting failed.')
|
|
||||||
if GUI:
|
|
||||||
GUI.addMessage.emit('Automatic output splitting failed. <a href='
|
|
||||||
'"https://github.com/ciromattia/kcc/wiki'
|
|
||||||
'/Automatic-output-splitting">'
|
|
||||||
'More details.</a>', 'warning', False)
|
|
||||||
GUI.addMessage.emit('', '', False)
|
|
||||||
return [path]
|
|
||||||
# Split directories
|
|
||||||
splitter = splitDirectory(os.path.join(path, 'OEBPS', 'Images'), mode)
|
|
||||||
path = [path]
|
|
||||||
for tome in splitter:
|
|
||||||
path.append(tome)
|
|
||||||
return path
|
|
||||||
else:
|
else:
|
||||||
# No splitting is necessary
|
if filesNumber > 0:
|
||||||
return [path]
|
print('\nWARNING: Automatic output splitting failed.')
|
||||||
|
if GUI:
|
||||||
|
GUI.addMessage.emit('Automatic output splitting failed. <a href='
|
||||||
|
'"https://github.com/ciromattia/kcc/wiki'
|
||||||
|
'/Automatic-output-splitting">'
|
||||||
|
'More details.</a>', 'warning', False)
|
||||||
|
GUI.addMessage.emit('', '', False)
|
||||||
|
return [path]
|
||||||
|
detectedSubSubdirectories = False
|
||||||
|
detectedFilesInSubdirectories = False
|
||||||
|
for root, dirs, files in walkLevel(os.path.join(path, 'OEBPS', 'Images'), 1):
|
||||||
|
if root != os.path.join(path, 'OEBPS', 'Images'):
|
||||||
|
if len(dirs) != 0:
|
||||||
|
detectedSubSubdirectories = True
|
||||||
|
elif len(dirs) == 0 and detectedSubSubdirectories:
|
||||||
|
print('\nWARNING: Automatic output splitting failed.')
|
||||||
|
if GUI:
|
||||||
|
GUI.addMessage.emit('Automatic output splitting failed. <a href='
|
||||||
|
'"https://github.com/ciromattia/kcc/wiki'
|
||||||
|
'/Automatic-output-splitting">'
|
||||||
|
'More details.</a>', 'warning', False)
|
||||||
|
GUI.addMessage.emit('', '', False)
|
||||||
|
return [path]
|
||||||
|
if len(files) != 0:
|
||||||
|
detectedFilesInSubdirectories = True
|
||||||
|
if detectedSubSubdirectories:
|
||||||
|
# Two levels of subdirectories
|
||||||
|
mode = 2
|
||||||
|
else:
|
||||||
|
# One level of subdirectories
|
||||||
|
mode = 1
|
||||||
|
if detectedFilesInSubdirectories and detectedSubSubdirectories:
|
||||||
|
print('\nWARNING: Automatic output splitting failed.')
|
||||||
|
if GUI:
|
||||||
|
GUI.addMessage.emit('Automatic output splitting failed. <a href='
|
||||||
|
'"https://github.com/ciromattia/kcc/wiki'
|
||||||
|
'/Automatic-output-splitting">'
|
||||||
|
'More details.</a>', 'warning', False)
|
||||||
|
GUI.addMessage.emit('', '', False)
|
||||||
|
return [path]
|
||||||
|
# Split directories
|
||||||
|
splitter = splitDirectory(os.path.join(path, 'OEBPS', 'Images'), mode)
|
||||||
|
path = [path]
|
||||||
|
for tome in splitter:
|
||||||
|
path.append(tome)
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
def detectCorruption(tmpPath, orgPath):
|
def detectCorruption(tmpPath, orgPath):
|
||||||
|
|||||||
Reference in New Issue
Block a user