mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 01:36:27 +00:00
Tweaks for Windows binary
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
environment:
|
||||
PYTHON: "C:\\Python37-x64"
|
||||
PYTHON: "C:\\Python36-x64"
|
||||
|
||||
install:
|
||||
- set PATH="%PYTHON%\\Scripts";"C:\\Program Files (x86)\\Inno Setup 5";%PATH%
|
||||
|
||||
@@ -175,7 +175,8 @@ class VersionThread(QtCore.QThread):
|
||||
move(path[0], path[0] + '.exe')
|
||||
MW.hideProgressBar.emit()
|
||||
MW.modeConvert.emit(1)
|
||||
Popen(path[0] + '.exe /SP- /silent /noicons', stdout=PIPE, stderr=STDOUT, shell=True)
|
||||
Popen(path[0] + '.exe /SP- /silent /noicons', stdout=PIPE, stderr=STDOUT, stdin=PIPE, close_fds=True,
|
||||
shell=True)
|
||||
MW.forceShutdown.emit()
|
||||
except Exception:
|
||||
MW.addMessage.emit('Failed to download the update!', 'warning', False)
|
||||
@@ -836,11 +837,11 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
||||
os.chmod('/usr/local/bin/kindlegen', 0o755)
|
||||
except Exception:
|
||||
pass
|
||||
kindleGenExitCode = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, shell=True)
|
||||
kindleGenExitCode = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
|
||||
kindleGenExitCode.communicate()
|
||||
if kindleGenExitCode.returncode == 0:
|
||||
self.kindleGen = True
|
||||
versionCheck = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, shell=True)
|
||||
versionCheck = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
|
||||
for line in versionCheck.stdout:
|
||||
line = line.decode("utf-8")
|
||||
if 'Amazon kindlegen' in line:
|
||||
@@ -991,7 +992,7 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
||||
self.addMessage('Since you are a new user of <b>KCC</b> please see few '
|
||||
'<a href="https://github.com/ciromattia/kcc/wiki/Important-tips">important tips</a>.',
|
||||
'info')
|
||||
process = Popen('7z', stdout=PIPE, stderr=STDOUT, shell=True)
|
||||
process = Popen('7z', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
|
||||
process.communicate()
|
||||
if process.returncode == 0 or process.returncode == 7:
|
||||
self.sevenzip = True
|
||||
|
||||
@@ -1033,13 +1033,13 @@ def checkTools(source):
|
||||
source = source.upper()
|
||||
if source.endswith('.CB7') or source.endswith('.7Z') or source.endswith('.RAR') or source.endswith('.CBR') or \
|
||||
source.endswith('.ZIP') or source.endswith('.CBZ'):
|
||||
process = Popen('7z', stdout=PIPE, stderr=STDOUT, shell=True)
|
||||
process = Popen('7z', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
|
||||
process.communicate()
|
||||
if process.returncode != 0 and process.returncode != 7:
|
||||
print('ERROR: 7z is missing!')
|
||||
exit(1)
|
||||
if options.format == 'MOBI':
|
||||
kindleGenExitCode = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, shell=True)
|
||||
kindleGenExitCode = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
|
||||
kindleGenExitCode.communicate()
|
||||
if kindleGenExitCode.returncode != 0:
|
||||
print('ERROR: KindleGen is missing!')
|
||||
@@ -1188,7 +1188,7 @@ def makeMOBIWorker(item):
|
||||
try:
|
||||
if os.path.getsize(item) < 629145600:
|
||||
output = Popen('kindlegen -dont_append_source -locale en "' + item + '"',
|
||||
stdout=PIPE, stderr=STDOUT, shell=True)
|
||||
stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
|
||||
for line in output.stdout:
|
||||
line = line.decode('utf-8')
|
||||
# ERROR: Generic error
|
||||
|
||||
@@ -32,7 +32,7 @@ class ComicArchive:
|
||||
self.type = None
|
||||
if not os.path.isfile(self.filepath):
|
||||
raise OSError('File not found.')
|
||||
process = Popen('7z l -y -p1 "' + self.filepath + '"', stderr=STDOUT, stdout=PIPE, shell=True)
|
||||
process = Popen('7z l -y -p1 "' + self.filepath + '"', stderr=STDOUT, stdout=PIPE, stdin=PIPE, shell=True)
|
||||
for line in process.stdout:
|
||||
if b'Type =' in line:
|
||||
self.type = line.rstrip().decode().split(' = ')[1].upper()
|
||||
@@ -47,7 +47,7 @@ class ComicArchive:
|
||||
if not os.path.isdir(targetdir):
|
||||
raise OSError('Target directory don\'t exist.')
|
||||
process = Popen('7z x -y -xr!__MACOSX -xr!.DS_Store -xr!thumbs.db -xr!Thumbs.db -o"' + targetdir + '" "' +
|
||||
self.filepath + '"', stdout=PIPE, stderr=STDOUT, shell=True)
|
||||
self.filepath + '"', stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
|
||||
process.communicate()
|
||||
if process.returncode != 0:
|
||||
raise OSError('Failed to extract archive.')
|
||||
@@ -64,14 +64,14 @@ class ComicArchive:
|
||||
if self.type in ['RAR', 'RAR5']:
|
||||
raise NotImplementedError
|
||||
process = Popen('7z a -y "' + self.filepath + '" "' + sourcefile + '"',
|
||||
stdout=PIPE, stderr=STDOUT, shell=True)
|
||||
stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
|
||||
process.communicate()
|
||||
if process.returncode != 0:
|
||||
raise OSError('Failed to add the file.')
|
||||
|
||||
def extractMetadata(self):
|
||||
process = Popen('7z x -y -so "' + self.filepath + '" ComicInfo.xml',
|
||||
stdout=PIPE, stderr=STDOUT, shell=True)
|
||||
stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
|
||||
xml = process.communicate()
|
||||
if process.returncode != 0:
|
||||
raise OSError('Failed to extract archive.')
|
||||
|
||||
Reference in New Issue
Block a user