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