about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaweł Jastrzębski <pawelj@vulturis.eu>2014-04-24 22:11:37 +0200
committerPaweł Jastrzębski <pawelj@vulturis.eu>2014-04-24 22:11:37 +0200
commitc5f09c44b8668efba841d4c4594be11d752dd098 (patch)
tree8362b3c25c76ff3339d116b82ac21e02191b3b65
parentChanged output extension to AZW3 (diff)
downloadkcc-c5f09c44b8668efba841d4c4594be11d752dd098.tar.gz
kcc-c5f09c44b8668efba841d4c4594be11d752dd098.tar.bz2
kcc-c5f09c44b8668efba841d4c4594be11d752dd098.zip
Bumped a little MOBI file size limit
-rw-r--r--kcc/KCC_gui.py7
-rwxr-xr-xkcc/comic2ebook.py10
2 files changed, 10 insertions, 7 deletions
diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py
index 01601a4..f0b9501 100644
--- a/kcc/KCC_gui.py
+++ b/kcc/KCC_gui.py
@@ -285,7 +285,8 @@ class KindleGenThread(QtCore.QRunnable):
         kindlegenError = ''
         try:
             if os.path.getsize(self.work) < 367001600:
-                output = Popen('kindlegen -locale en "' + self.work + '"', stdout=PIPE, stderr=STDOUT, shell=True)
+                output = Popen('kindlegen -dont_append_source -locale en "' + self.work + '"', stdout=PIPE,
+                               stderr=STDOUT, shell=True)
                 for line in output.stdout:
                     line = line.decode('utf-8')
                     # ERROR: Generic error
@@ -503,6 +504,7 @@ class WorkerThread(QtCore.QThread):
                         for item in outputPath:
                             if os.path.exists(item):
                                 os.remove(item)
+                            sleep(1)
                             if os.path.exists(item.replace('.epub', '.mobi')):
                                 os.remove(item.replace('.epub', '.mobi'))
                         self.clean()
@@ -557,6 +559,7 @@ class WorkerThread(QtCore.QThread):
                         for item in outputPath:
                             if os.path.exists(item):
                                 os.remove(item)
+                            sleep(1)
                             if os.path.exists(item.replace('.epub', '.mobi')):
                                 os.remove(item.replace('.epub', '.mobi'))
                         MW.addMessage.emit('KindleGen failed to create ' + extensionC + '!', 'error', False)
@@ -565,7 +568,7 @@ class WorkerThread(QtCore.QThread):
                             MW.showDialog.emit("KindleGen error:\n\n" + self.kindlegenErrorCode[1], 'error')
                         if self.kindlegenErrorCode[0] == 23026:
                             MW.addMessage.emit('Created EPUB file was too big.', 'error', False)
-                            MW.addMessage.emit('EPUB file: ' + str(epubSize) + 'MB. Supported size: ~300MB.', 'error',
+                            MW.addMessage.emit('EPUB file: ' + str(epubSize) + 'MB. Supported size: ~350MB.', 'error',
                                                False)
                 else:
                     for item in outputPath:
diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py
index ff50338..cb22117 100755
--- a/kcc/comic2ebook.py
+++ b/kcc/comic2ebook.py
@@ -729,7 +729,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 > 262144000:
+                if currentSize + size > 314572800:
                     currentTarget, pathRoot = createNewTome()
                     output.append(pathRoot)
                     currentSize = size
@@ -741,7 +741,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 > 262144000:
+                if currentSize + size > 314572800:
                     currentTarget, pathRoot = createNewTome()
                     output.append(pathRoot)
                     currentSize = size
@@ -755,7 +755,7 @@ def splitDirectory(path, mode):
             for name in dirs:
                 size = getDirectorySize(os.path.join(root, name))
                 currentSize = 0
-                if size > 262144000:
+                if size > 314572800:
                     if not firstTome:
                         currentTarget, pathRoot = createNewTome()
                         output.append(pathRoot)
@@ -764,7 +764,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 > 262144000:
+                            if currentSize + size > 314572800:
                                 currentTarget, pathRoot = createNewTome()
                                 output.append(pathRoot)
                                 currentSize = size
@@ -784,7 +784,7 @@ def splitDirectory(path, mode):
 
 #noinspection PyUnboundLocalVariable
 def preSplitDirectory(path):
-    if getDirectorySize(os.path.join(path, 'OEBPS', 'Images')) > 262144000:
+    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)