diff options
-rw-r--r-- | KCC-Linux.ui | 2 | ||||
-rw-r--r-- | KCC-OSX.ui | 2 | ||||
-rw-r--r-- | KCC.ui | 2 | ||||
-rw-r--r-- | kcc/KCC_gui.py | 2 | ||||
-rw-r--r-- | kcc/KCC_ui.py | 4 | ||||
-rw-r--r-- | kcc/KCC_ui_linux.py | 4 | ||||
-rw-r--r-- | kcc/KCC_ui_osx.py | 4 | ||||
-rwxr-xr-x | kcc/comic2ebook.py | 125 |
8 files changed, 72 insertions, 73 deletions
diff --git a/KCC-Linux.ui b/KCC-Linux.ui index ffcf342..6c6c2f8 100644 --- a/KCC-Linux.ui +++ b/KCC-Linux.ui @@ -386,7 +386,7 @@ <enum>Qt::NoFocus</enum> </property> <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 name="text"> <string>High/Ultra quality</string> diff --git a/KCC-OSX.ui b/KCC-OSX.ui index 1b56fbc..28e1daa 100644 --- a/KCC-OSX.ui +++ b/KCC-OSX.ui @@ -391,7 +391,7 @@ <enum>Qt::NoFocus</enum> </property> <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 name="text"> <string>High/Ultra quality</string> diff --git a/KCC.ui b/KCC.ui index 8da5179..28b7cd9 100644 --- a/KCC.ui +++ b/KCC.ui @@ -338,7 +338,7 @@ <enum>Qt::NoFocus</enum> </property> <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 name="text"> <string>High/Ultra quality</string> diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py index 0cb8ca1..7cc66a4 100644 --- a/kcc/KCC_gui.py +++ b/kcc/KCC_gui.py @@ -278,7 +278,7 @@ class KindleGenThread(QtCore.QRunnable): kindlegenErrorCode = 0 kindlegenError = '' 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, stderr=STDOUT, shell=True) for line in output.stdout: diff --git a/kcc/KCC_ui.py b/kcc/KCC_ui.py index 9867698..612009a 100644 --- a/kcc/KCC_ui.py +++ b/kcc/KCC_ui.py @@ -2,7 +2,7 @@ # 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 # # 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.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.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.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")) diff --git a/kcc/KCC_ui_linux.py b/kcc/KCC_ui_linux.py index d30fe4e..cdc0661 100644 --- a/kcc/KCC_ui_linux.py +++ b/kcc/KCC_ui_linux.py @@ -2,7 +2,7 @@ # 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 # # 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.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.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.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")) diff --git a/kcc/KCC_ui_osx.py b/kcc/KCC_ui_osx.py index 7b30f58..4bc9848 100644 --- a/kcc/KCC_ui_osx.py +++ b/kcc/KCC_ui_osx.py @@ -2,7 +2,7 @@ # 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 # # 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.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.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.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")) diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index c7f540b..f84382e 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -231,7 +231,10 @@ def buildNCX(dstdir, title, chapters, chapterNames): def buildOPF(dstdir, title, filelist, cover=None): opffile = os.path.join(dstdir, 'OEBPS', 'content.opf') 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: writingmode = "horizontal-rl" else: @@ -729,7 +732,7 @@ def splitDirectory(path, mode): for root, dirs, files in walkLevel(path, 0): for name in files: size = os.path.getsize(os.path.join(root, name)) - if currentSize + size > 314572800: + if currentSize + size > 419430400: currentTarget, pathRoot = createNewTome() output.append(pathRoot) currentSize = size @@ -741,7 +744,7 @@ def splitDirectory(path, mode): for root, dirs, files in walkLevel(path, 0): for name in dirs: size = getDirectorySize(os.path.join(root, name)) - if currentSize + size > 314572800: + if currentSize + size > 419430400: currentTarget, pathRoot = createNewTome() output.append(pathRoot) currentSize = size @@ -755,7 +758,7 @@ def splitDirectory(path, mode): for name in dirs: size = getDirectorySize(os.path.join(root, name)) currentSize = 0 - if size > 314572800: + if size > 419430400: if not firstTome: currentTarget, pathRoot = createNewTome() output.append(pathRoot) @@ -764,7 +767,7 @@ def splitDirectory(path, mode): for rootInside, dirsInside, filesInside in walkLevel(os.path.join(root, name), 0): for nameInside in dirsInside: size = getDirectorySize(os.path.join(rootInside, nameInside)) - if currentSize + size > 314572800: + if currentSize + size > 419430400: currentTarget, pathRoot = createNewTome() output.append(pathRoot) currentSize = size @@ -784,65 +787,61 @@ def splitDirectory(path, mode): #noinspection PyUnboundLocalVariable def preSplitDirectory(path): - if getDirectorySize(os.path.join(path, 'OEBPS', 'Images')) > 314572800: - # Detect directory stucture - for root, dirs, files in walkLevel(os.path.join(path, 'OEBPS', 'Images'), 0): - subdirectoryNumber = len(dirs) - filesNumber = len(files) - if subdirectoryNumber == 0: - # No subdirectories - 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 + # Detect directory stucture + for root, dirs, files in walkLevel(os.path.join(path, 'OEBPS', 'Images'), 0): + subdirectoryNumber = len(dirs) + filesNumber = len(files) + if subdirectoryNumber == 0: + # No subdirectories + mode = 0 else: - # No splitting is necessary - return [path] + 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 def detectCorruption(tmpPath, orgPath): |