From 5902d88d98220ba93e6860f839b3f0891f4bc60b Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Tue, 4 Jul 2023 03:48:04 -0700 Subject: [PATCH 1/4] remove dead download links (#544) * remove old links --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index a74562f..92ba241 100644 --- a/README.md +++ b/README.md @@ -39,10 +39,6 @@ You can find the latest binary at the following link: - flatpak : https://flathub.org/apps/details/io.github.ciromattia.kcc - Docker: https://github.com/ciromattia/kcc/pkgs/container/kcc -~~- **[Windows](http://kcc.iosphe.re/Windows/) (64-bit only)**~~ -~~- **[macOS](http://kcc.iosphe.re/OSX/) (10.14+)**~~ -~~- **Linux:** Currently unavailable.~~ - more information on [installation](https://github.com/ciromattia/kcc/wiki/Installation) ### DEPENDENCIES From a5202458dcf573b901caa9d8a21d9ffc92c3a175 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Wed, 5 Jul 2023 09:54:24 -0700 Subject: [PATCH 2/4] Merge pull request #553 * warn p7zip-rar * replace strerror --- kindlecomicconverter/comic2ebook.py | 2 +- kindlecomicconverter/metadata.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index 7ff7d97..049e44c 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -631,7 +631,7 @@ def getWorkFolder(afile): path = cbx.extract(workdir) except OSError as e: rmtree(workdir, True) - raise UserWarning(e.strerror) + raise UserWarning(e) else: raise UserWarning("Failed to open source file/directory.") sanitizePermissions(path) diff --git a/kindlecomicconverter/metadata.py b/kindlecomicconverter/metadata.py index 9d60616..51ade3b 100644 --- a/kindlecomicconverter/metadata.py +++ b/kindlecomicconverter/metadata.py @@ -46,7 +46,7 @@ class MetadataParser: self.rawdata = cbx.extractMetadata() self.format = cbx.type except OSError as e: - raise UserWarning(e.strerror) + raise UserWarning(e) if self.rawdata: self.parseXML() @@ -121,5 +121,5 @@ class MetadataParser: cbx = comicarchive.ComicArchive(self.source) cbx.addFile(tmpXML) except OSError as e: - raise UserWarning(e.strerror) + raise UserWarning(e) rmtree(workdir) From 531cea88e610354d921c51d85690f7e5b44bd066 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Tue, 25 Jul 2023 12:27:56 -0700 Subject: [PATCH 3/4] Add 7z and Kindle Previewer 3 to PATH in all scenarios (#560) * add 7z and KP3 to path --------- Co-authored-by: darodi <4682830+darodi@users.noreply.github.com> --- kcc.py | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/kcc.py b/kcc.py index 8e12cfd..3c18461 100755 --- a/kcc.py +++ b/kcc.py @@ -27,22 +27,37 @@ if sys.version_info < (3, 8, 0): # OS specific workarounds import os if sys.platform.startswith('darwin'): + mac_paths = [ + '/Applications/Kindle Previewer 3.app/Contents/lib/fc/bin/', + '/Applications/Kindle Comic Creator/Kindle Comic Creator.app/Contents/MacOS', + ] if getattr(sys, 'frozen', False): - os.environ['PATH'] = os.path.dirname(os.path.abspath(sys.executable)) + \ - '/../Resources:/Applications/Kindle Comic Creator/Kindle Comic Creator.app/Contents/MacOS:' \ - '/Applications/Kindle Previewer 3.app/Contents/lib/fc/bin/:/usr/local/bin:/usr/bin:/bin' + os.environ['PATH'] += os.pathsep + os.pathsep.join(mac_paths + + [ + os.path.dirname(os.path.abspath(sys.executable)) + '/../Resources', + '/usr/local/bin', + '/usr/bin', + '/bin', + ] + ) os.chdir(os.path.dirname(os.path.abspath(sys.executable)) + '/../Resources') else: + os.environ['PATH'] += os.pathsep + os.pathsep.join(mac_paths) os.chdir(os.path.dirname(os.path.abspath(__file__))) elif sys.platform.startswith('win'): + win_paths = [ + '%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\', + 'C:\\Program Files\\7-Zip', + ] if getattr(sys, 'frozen', False): - os.environ['PATH'] = '%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\;' + \ - os.environ['PATH'] + os.environ['PATH'] += os.pathsep + os.pathsep.join(win_paths) os.chdir(os.path.dirname(os.path.abspath(sys.executable))) else: - os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + '/other/windows/;' \ - '%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\;' + \ - os.environ['PATH'] + os.environ['PATH'] += os.pathsep + os.pathsep.join(win_paths + + [ + os.path.dirname(os.path.abspath(__file__)) + '/other/windows/', + ] + ) os.chdir(os.path.dirname(os.path.abspath(__file__))) # Load additional Sentry configuration # if getattr(sys, 'frozen', False): From 217f571f3d8b24fca13667de46e59effb926dc44 Mon Sep 17 00:00:00 2001 From: darodi <4682830+darodi@users.noreply.github.com> Date: Tue, 25 Jul 2023 19:31:02 +0000 Subject: [PATCH 4/4] refactor display when kindlegen is missing (#555) display_kindlegen_missing --- README.md | 8 ++++--- kindlecomicconverter/KCC_gui.py | 40 ++++++++++++++++----------------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 92ba241..1e25eb9 100644 --- a/README.md +++ b/README.md @@ -67,9 +67,11 @@ $ sudo apt-get install -y python3 python3-dev libpng-dev libjpeg-dev p7zip-full $ sudo apt-get install qt5dxcb-plugin ``` -- KindleGen ~~[deprecated link](http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211)~~ v2.9+ in a directory reachable by your _PATH_ or in _KCC_ directory *(For MOBI generation) - - It 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 ~~[(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/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py index e239277..212c972 100644 --- a/kindlecomicconverter/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -743,18 +743,25 @@ class KCCGUI(KCC_ui.Ui_mainWindow): self.detectKindleGen() if not self.kindleGen: GUI.jobList.clear() - self.addMessage('Cannot find KindleGen! 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 it using Homebrew.', 'error') - else: - self.addMessage('Download it and place executable in /usr/local/bin directory.', 'error') + self.display_kindlegen_missing() self.needClean = True return 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') + def saveSettings(self, event): if self.conversionAlive: GUI.convertButton.setEnabled(False) @@ -848,22 +855,15 @@ class KCCGUI(KCC_ui.Ui_mainWindow): if 'Amazon kindlegen' in line: versionCheck = line.split('V')[1].split(' ')[0] if StrictVersion(versionCheck) < StrictVersion('2.9'): - self.addMessage('Your KindleGen is outdated! MOBI conversion might fail.', 'warning') + self.addMessage('Your KindleGen' + ' is outdated! MOBI conversion might fail.', 'warning') break else: self.kindleGen = False if startup: - self.addMessage('Cannot find ' - 'KindleGen! MOBI conversion will be 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 it using Homebrew: ' - 'brew install --cask kindle-comic-creator or ' - 'brew install --cask kindle-previewer', 'error') - else: - self.addMessage('Download it and place executable in /usr/local/bin directory.', 'error') + self.display_kindlegen_missing() + + def __init__(self, kccapp, kccwindow): global APP, MW, GUI