From 0d417b8e11caaae5db00ae942fa78428fa64682c Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Tue, 8 Aug 2023 13:25:03 -0700 Subject: [PATCH] prioritize KC2 over KP3 kindlegen version (#574) * prioritize KC2 over KP3 * remove link to buggy KP3 kindlegen * prioritize KC2 since KP3 version is buggy as of v3.72 * add kindlegen install link * update comments --- README.md | 1 - kcc.py | 6 ++++-- kindlecomicconverter/KCC_gui.py | 16 ++++------------ 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 1e25eb9..5358f66 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,6 @@ $ sudo apt-get install qt5dxcb-plugin - KindleGen ~~[(deprecated link)](http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211)~~ v2.9+ (For MOBI generation) - should be placed in a directory reachable by your _PATH_ or in _KCC_ directory - `KindleGen` can be found in [Kindle Previewer](https://www.amazon.com/Kindle-Previewer/b?ie=UTF8&node=21381691011) - `Amazon Kindle Previewer 3 Folder\lib\fc\bin`, the usual location in windows is in windows is `C:\Users\user\AppData\Local\Amazon\Kindle Previewer 3\lib\fc\bin\` - `KindleGen` can be also be found in [Kindle Comic Creator](https://www.amazon.com/b?node=23496309011) - [7z](http://www.7-zip.org/download.html) *(For CBZ/ZIP, CBR/RAR, 7z/CB7 support)* - Unrar (no rar in 7z on Fedora) diff --git a/kcc.py b/kcc.py index 67db9d6..9d5e0e6 100755 --- a/kcc.py +++ b/kcc.py @@ -27,9 +27,10 @@ if sys.version_info < (3, 8, 0): # OS specific workarounds import os if sys.platform.startswith('darwin'): + # prioritize KC2 since it optionally also installs KP3 mac_paths = [ - '/Applications/Kindle Previewer 3.app/Contents/lib/fc/bin/', '/Applications/Kindle Comic Creator/Kindle Comic Creator.app/Contents/MacOS', + '/Applications/Kindle Previewer 3.app/Contents/lib/fc/bin/', ] if getattr(sys, 'frozen', False): os.environ['PATH'] += os.pathsep + os.pathsep.join(mac_paths + @@ -45,9 +46,10 @@ if sys.platform.startswith('darwin'): os.environ['PATH'] += os.pathsep + os.pathsep.join(mac_paths) os.chdir(os.path.dirname(os.path.abspath(__file__))) elif sys.platform.startswith('win'): + # prioritize KC2 since it optionally also installs KP3 win_paths = [ - os.path.expandvars('%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\'), os.path.expandvars('%LOCALAPPDATA%\\Amazon\\KC2'), + os.path.expandvars('%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\'), 'C:\\Program Files\\7-Zip', ] if getattr(sys, 'frozen', False): diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py index 0ffc55d..264bbf1 100644 --- a/kindlecomicconverter/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -751,18 +751,10 @@ class KCCGUI(KCC_ui.Ui_mainWindow): self.worker.start() def display_kindlegen_missing(self): - self.addMessage('Cannot find KindleGen from ' - 'Kindle Comic Creator or ' - '' - 'Kindle Previewer! MOBI conversion is unavailable!', 'error') - if sys.platform.startswith('win'): - self.addMessage('Download it and place EXE in KCC directory.', 'error') - elif sys.platform.startswith('darwin'): - self.addMessage('' - 'Install the kindle-comic-creator cask using Homebrew to enable MOBI conversion', - 'error') - else: - self.addMessage('Download it and place executable in /usr/local/bin directory.', 'error') + self.addMessage( + 'Cannot find KindleGen: MOBI conversion is unavailable!', + 'error' + ) def saveSettings(self, event): if self.conversionAlive: