1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-12 17:26:23 +00:00

Bumped a little MOBI file size limit

This commit is contained in:
Paweł Jastrzębski
2014-04-24 22:11:37 +02:00
parent 64b199ef74
commit c5f09c44b8
2 changed files with 10 additions and 7 deletions

View File

@@ -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:

View File

@@ -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)