about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaweł Jastrzębski <[email protected]>2016-01-03 19:05:34 +0100
committerPaweł Jastrzębski <[email protected]>2016-01-03 19:05:34 +0100
commit04cf732d5058b1fd461ae9fde4c35da3c0e3d703 (patch)
tree7369fd52dd16828ea65af34ea0f8478d8d74ae1d
parentError handling tweaks (diff)
parentkindlegen is now forced to terminate (diff)
downloadkcc-04cf732d5058b1fd461ae9fde4c35da3c0e3d703.tar.gz
kcc-04cf732d5058b1fd461ae9fde4c35da3c0e3d703.tar.bz2
kcc-04cf732d5058b1fd461ae9fde4c35da3c0e3d703.zip
Merge branch 'tamodolo-master' into dev
-rwxr-xr-xkcc/comic2ebook.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py
index cd7ec82..b069311 100755
--- a/kcc/comic2ebook.py
+++ b/kcc/comic2ebook.py
@@ -1230,8 +1230,9 @@ def makeMOBIWorker(item):
     kindlegenError = ''
     try:
         if os.path.getsize(item) < 629145600:
+            print("Creating MOBI file...")
             output = Popen('kindlegen -dont_append_source -locale en "' + item + '"',
-                           stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
+                           stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=False)
             for line in output.stdout:
                 line = line.decode('utf-8')
                 # ERROR: Generic error
@@ -1243,6 +1244,8 @@ def makeMOBIWorker(item):
                     kindlegenErrorCode = 23026
                 if kindlegenErrorCode > 0:
                     break
+                if "Mobi file built successfully" in line:
+                    output.terminate()
         else:
             # ERROR: EPUB too big
             kindlegenErrorCode = 23026