mirror of
https://github.com/ciromattia/kcc
synced 2026-07-06 13:05:32 +00:00
Merge branch 'master' into pyqt6
This commit is contained in:
@@ -62,9 +62,12 @@ $ sudo apt-get install -y python3 python3-dev libpng-dev libjpeg-dev p7zip-full
|
|||||||
|
|
||||||
|
|
||||||
#### Optional dependencies
|
#### Optional dependencies
|
||||||
- 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)
|
- KindleGen ~~[(deprecated link)](http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211)~~ v2.9+ (For MOBI generation)
|
||||||
- It can be found in [Kindle Previewer](https://www.amazon.com/Kindle-Previewer/b?ie=UTF8&node=21381691011)
|
- should be placed in a directory reachable by your _PATH_ or in _KCC_ directory
|
||||||
`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 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)*
|
- [7z](http://www.7-zip.org/download.html) *(For CBZ/ZIP, CBR/RAR, 7z/CB7 support)*
|
||||||
- Unrar (no rar in 7z on Fedora)
|
- Unrar (no rar in 7z on Fedora)
|
||||||
|
|
||||||
|
|||||||
@@ -27,22 +27,37 @@ if sys.version_info < (3, 8, 0):
|
|||||||
# OS specific workarounds
|
# OS specific workarounds
|
||||||
import os
|
import os
|
||||||
if sys.platform.startswith('darwin'):
|
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):
|
if getattr(sys, 'frozen', False):
|
||||||
os.environ['PATH'] = os.path.dirname(os.path.abspath(sys.executable)) + \
|
os.environ['PATH'] += os.pathsep + os.pathsep.join(mac_paths +
|
||||||
'/../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.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')
|
os.chdir(os.path.dirname(os.path.abspath(sys.executable)) + '/../Resources')
|
||||||
else:
|
else:
|
||||||
|
os.environ['PATH'] += os.pathsep + os.pathsep.join(mac_paths)
|
||||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||||
elif sys.platform.startswith('win'):
|
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):
|
if getattr(sys, 'frozen', False):
|
||||||
os.environ['PATH'] = '%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\;' + \
|
os.environ['PATH'] += os.pathsep + os.pathsep.join(win_paths)
|
||||||
os.environ['PATH']
|
|
||||||
os.chdir(os.path.dirname(os.path.abspath(sys.executable)))
|
os.chdir(os.path.dirname(os.path.abspath(sys.executable)))
|
||||||
else:
|
else:
|
||||||
os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + '/other/windows/;' \
|
os.environ['PATH'] += os.pathsep + os.pathsep.join(win_paths +
|
||||||
'%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\;' + \
|
[
|
||||||
os.environ['PATH']
|
os.path.dirname(os.path.abspath(__file__)) + '/other/windows/',
|
||||||
|
]
|
||||||
|
)
|
||||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||||
# Load additional Sentry configuration
|
# Load additional Sentry configuration
|
||||||
# if getattr(sys, 'frozen', False):
|
# if getattr(sys, 'frozen', False):
|
||||||
|
|||||||
@@ -744,18 +744,25 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
|||||||
self.detectKindleGen()
|
self.detectKindleGen()
|
||||||
if not self.kindleGen:
|
if not self.kindleGen:
|
||||||
GUI.jobList.clear()
|
GUI.jobList.clear()
|
||||||
self.addMessage('Cannot find <a href="http://www.amazon.com/gp/feature.html?ie=UTF8&docId='
|
self.display_kindlegen_missing()
|
||||||
'1000765211"><b>KindleGen</b></a>! 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 <a href="http://brew.sh/">Homebrew</a>.', 'error')
|
|
||||||
else:
|
|
||||||
self.addMessage('Download it and place executable in /usr/local/bin directory.', 'error')
|
|
||||||
self.needClean = True
|
self.needClean = True
|
||||||
return
|
return
|
||||||
self.worker.start()
|
self.worker.start()
|
||||||
|
|
||||||
|
def display_kindlegen_missing(self):
|
||||||
|
self.addMessage('Cannot find <b>KindleGen</b> from '
|
||||||
|
'<a href="https://www.amazon.com/b?node=23496309011"><b>Kindle Comic Creator</b></a> or '
|
||||||
|
'<a href="https://www.amazon.com/Kindle-Previewer/b?ie=UTF8&node=21381691011">'
|
||||||
|
'<b>Kindle Previewer</b></a>! 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('<a href="https://github.com/ciromattia/kcc/wiki/Installation/_edit#kindlegen">'
|
||||||
|
'Install the kindle-comic-creator cask using Homebrew</a> to enable MOBI conversion',
|
||||||
|
'error')
|
||||||
|
else:
|
||||||
|
self.addMessage('Download it and place executable in /usr/local/bin directory.', 'error')
|
||||||
|
|
||||||
def saveSettings(self, event):
|
def saveSettings(self, event):
|
||||||
if self.conversionAlive:
|
if self.conversionAlive:
|
||||||
GUI.convertButton.setEnabled(False)
|
GUI.convertButton.setEnabled(False)
|
||||||
@@ -849,22 +856,15 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
|||||||
if 'Amazon kindlegen' in line:
|
if 'Amazon kindlegen' in line:
|
||||||
versionCheck = line.split('V')[1].split(' ')[0]
|
versionCheck = line.split('V')[1].split(' ')[0]
|
||||||
if StrictVersion(versionCheck) < StrictVersion('2.9'):
|
if StrictVersion(versionCheck) < StrictVersion('2.9'):
|
||||||
self.addMessage('Your <a href="http://www.amazon.com/gp/feature.html?ie=UTF8&docId='
|
self.addMessage('Your <a href="https://www.amazon.com/b?node=23496309011">KindleGen</a>'
|
||||||
'1000765211">KindleGen</a> is outdated! MOBI conversion might fail.', 'warning')
|
' is outdated! MOBI conversion might fail.', 'warning')
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
self.kindleGen = False
|
self.kindleGen = False
|
||||||
if startup:
|
if startup:
|
||||||
self.addMessage('Cannot find <a href="http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211">'
|
self.display_kindlegen_missing()
|
||||||
'<b>KindleGen</b></a>! 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 <a href="http://brew.sh/">Homebrew</a>: '
|
|
||||||
'<i>brew install --cask kindle-comic-creator</i> or '
|
|
||||||
'<i>brew install --cask kindle-previewer</i>', 'error')
|
|
||||||
else:
|
|
||||||
self.addMessage('Download it and place executable in /usr/local/bin directory.', 'error')
|
|
||||||
|
|
||||||
def __init__(self, kccapp, kccwindow):
|
def __init__(self, kccapp, kccwindow):
|
||||||
global APP, MW, GUI
|
global APP, MW, GUI
|
||||||
|
|||||||
Reference in New Issue
Block a user