mirror of
https://github.com/ciromattia/kcc
synced 2026-01-08 22:39:35 +00:00
Refactored KindleGen version check
This commit is contained in:
@@ -415,22 +415,15 @@ class Ui_KCC(object):
|
||||
self.addMessage('Welcome!', 'info')
|
||||
self.addMessage('Remember: All options have additional informations in tooltips.', 'info')
|
||||
if call('kindlegen', stdout=PIPE, stderr=STDOUT, shell=True) == 0:
|
||||
self.KindleGen = True
|
||||
formats = ['MOBI', 'EPUB', 'CBZ']
|
||||
versionCheck = Popen('kindlegen', stdout=PIPE, stderr=STDOUT, shell=True)
|
||||
for line in versionCheck.stdout:
|
||||
if "Amazon kindlegen" in line:
|
||||
versionCheck = line.split('V')[1].split(' ')[0]
|
||||
if tuple(map(int, (versionCheck.split(".")))) >= tuple(map(int, ('2.9'.split(".")))):
|
||||
versionCheck = True
|
||||
else:
|
||||
versionCheck = False
|
||||
if tuple(map(int, (versionCheck.split(".")))) < tuple(map(int, ('2.9'.split(".")))):
|
||||
self.addMessage('KindleGen is outdated! Creating MOBI might fail.', 'warning')
|
||||
break
|
||||
if versionCheck:
|
||||
self.KindleGen = True
|
||||
formats = ['MOBI', 'EPUB', 'CBZ']
|
||||
else:
|
||||
self.KindleGen = False
|
||||
formats = ['EPUB', 'CBZ']
|
||||
self.addMessage('KindleGen is outdated! Creating MOBI files is disabled.', 'warning')
|
||||
else:
|
||||
self.KindleGen = False
|
||||
formats = ['EPUB', 'CBZ']
|
||||
|
||||
Reference in New Issue
Block a user