diff options
| author | tamodolo <[email protected]> | 2016-01-03 14:49:21 -0200 |
|---|---|---|
| committer | tamodolo <[email protected]> | 2016-01-03 14:49:21 -0200 |
| commit | cb9059c231df2cef57f92ef8e06725768373290f (patch) | |
| tree | a3b3852c88a1fa65ed68ff9109e21e4c5cc0e8bb | |
| parent | Merge pull request #169 from ciromattia/dev (diff) | |
| download | kcc-cb9059c231df2cef57f92ef8e06725768373290f.tar.gz kcc-cb9059c231df2cef57f92ef8e06725768373290f.tar.bz2 kcc-cb9059c231df2cef57f92ef8e06725768373290f.zip | |
kindlegen is now forced to terminate
A bug in kindlegen causes it randonly to hang when converting epub to mobi. This happens above 90% of the time it is called so this change foce it to be killed as soon kcc detects it's donne the job. For this to work shell arg must be false. Otherwise terminate() will try to kill the new opened cmd/terminal instead of kindlegen.
| -rwxr-xr-x | kcc/comic2ebook.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index 48c0fa9..8b6dd84 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -1226,8 +1226,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 @@ -1239,6 +1240,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 |