about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaweł Jastrzębski <pawelj@vulturis.eu>2014-05-18 08:35:46 +0200
committerPaweł Jastrzębski <pawelj@vulturis.eu>2014-05-18 09:09:38 +0200
commit888663fa4cc73dce23399793108d43cbceb5b9d1 (patch)
tree164d4f71c846a7c509022b817715912edb30d25c
parentTiny tweaks for Linux (diff)
downloadkcc-888663fa4cc73dce23399793108d43cbceb5b9d1.tar.gz
kcc-888663fa4cc73dce23399793108d43cbceb5b9d1.tar.bz2
kcc-888663fa4cc73dce23399793108d43cbceb5b9d1.zip
Miscellaneous processing tweaks
-rw-r--r--KCC-Linux.ui2
-rw-r--r--KCC-OSX.ui2
-rw-r--r--KCC.ui2
-rw-r--r--kcc/KCC_gui.py2
-rw-r--r--kcc/KCC_ui.py4
-rw-r--r--kcc/KCC_ui_linux.py4
-rw-r--r--kcc/KCC_ui_osx.py4
-rwxr-xr-xkcc/comic2ebook.py125
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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Unchecked - Normal quality mode&lt;br/&gt;&lt;/span&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Use it when zoom is not needed.&lt;br/&gt;&lt;/span&gt;Overall quality: ★★★★★&lt;br/&gt;Zoom quality: ★&lt;br/&gt;File size: ★&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Indeterminate - High quality mode&lt;br/&gt;&lt;/span&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;A compromise between quality and size.&lt;br/&gt;&lt;/span&gt;Overall quality: ★★★★&lt;br/&gt;Zoom quality: ★★★&lt;br/&gt;File size: ★★★&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Checked - Ultra quality mode&lt;br/&gt;&lt;/span&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Highest possible quality. Recommended.&lt;br/&gt;&lt;/span&gt;Overall quality: ★★★★★&lt;br/&gt;Zoom quality: ★★★★★&lt;br/&gt;File size: ★★★★★&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Unchecked - Normal quality mode&lt;/span&gt;&lt;br/&gt;Maximal quality of images but very poor magnification quality.&lt;br/&gt;Use it only when zoom is not needed or output files needs to be small.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Indeterminate - High quality mode&lt;/span&gt;&lt;br/&gt;In most cases high quality of images and magnification.&lt;br/&gt;Overall quality highly depends on the resolution of source files.&lt;br/&gt;On Kindle models older than Paperwhite non-zoomed images might be a little blurred.&lt;br/&gt;&lt;br/&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Checked - Ultra quality mode&lt;/span&gt;&lt;br/&gt;Highest possible quality. Output files will be big.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Unchecked - Normal quality mode&lt;/span&gt;&lt;br/&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Use it when zoom is not needed.&lt;/span&gt;&lt;br/&gt;Overall quality: ★★★★★&lt;br/&gt;Zoom quality: ★&lt;br/&gt;File size: ★&lt;br/&gt;&lt;br/&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Indeterminate - High quality mode&lt;/span&gt;&lt;br/&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;A compromise between quality and size.&lt;/span&gt;&lt;br/&gt;Overall quality: ★★★★&lt;br/&gt;Zoom quality: ★★★&lt;br/&gt;File size: ★★★&lt;br/&gt;&lt;br/&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Checked - Ultra quality mode&lt;/span&gt;&lt;br/&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Highest possible quality. Recommended.&lt;/span&gt;&lt;br/&gt;Overall quality: ★★★★★&lt;br/&gt;Zoom quality: ★★★★★&lt;br/&gt;File size: ★★★★★&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Unchecked - Normal quality mode&lt;/span&gt;&lt;br/&gt;Maximal quality of images but very poor magnification quality.&lt;br/&gt;Use it only when zoom is not needed or output files needs to be small.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Indeterminate - High quality mode&lt;/span&gt;&lt;br/&gt;In most cases high quality of images and magnification.&lt;br/&gt;Overall quality highly depends on the resolution of source files.&lt;br/&gt;On Kindle models older than Paperwhite non-zoomed images might be a little blurred.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Checked - Ultra quality mode&lt;/span&gt;&lt;br/&gt;Highest possible quality. Output files will be big.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Unchecked - Normal quality mode&lt;br/&gt;&lt;/span&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Use it when zoom is not needed.&lt;/span&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;&lt;br/&gt;&lt;/span&gt;Overall quality: ★★★★★&lt;br/&gt;Zoom quality: ★&lt;br/&gt;File size: ★&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Indeterminate - High quality mode&lt;br/&gt;&lt;/span&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;A compromise between quality and size.&lt;/span&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;&lt;br/&gt;&lt;/span&gt;Overall quality: ★★★★&lt;br/&gt;Zoom quality: ★★★&lt;br/&gt;File size: ★★★&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Checked - Ultra quality mode&lt;br/&gt;&lt;/span&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Highest possible quality. Recommended.&lt;/span&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;&lt;br/&gt;&lt;/span&gt;Overall quality: ★★★★★&lt;br/&gt;Zoom quality: ★★★★★&lt;br/&gt;File size: ★★★★★&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p style=&quot;white-space:pre&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Unchecked - Normal quality mode&lt;br/&gt;&lt;/span&gt;Maximal quality of images but very poor magnification quality.&lt;br/&gt;Use it only when zoom is not needed or output files needs to be small.&lt;/p&gt;&lt;p style=&quot;white-space:pre&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Indeterminate - High quality mode&lt;br/&gt;&lt;/span&gt;In most cases high quality of images and magnification.&lt;br/&gt;Overall quality highly depends on the resolution of source files.&lt;br/&gt;On Kindle models older than Paperwhite non-zoomed images might be a little blurred.&lt;/p&gt;&lt;p style=&quot;white-space:pre&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Checked - Ultra quality mode&lt;br/&gt;&lt;/span&gt;Highest possible quality. Output files will be big.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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):