mirror of
https://github.com/ciromattia/kcc
synced 2025-12-25 15:41:44 +00:00
Merge pull request #566 from axu2/mac
Fix Mac CBZ, CBR, damaged, cover upload
This commit is contained in:
4
kcc.py
4
kcc.py
@@ -34,13 +34,13 @@ if sys.platform.startswith('darwin'):
|
||||
if getattr(sys, 'frozen', False):
|
||||
os.environ['PATH'] += os.pathsep + os.pathsep.join(mac_paths +
|
||||
[
|
||||
os.path.dirname(os.path.abspath(sys.executable)) + '/../Resources',
|
||||
'/opt/homebrew/bin',
|
||||
'/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)))
|
||||
else:
|
||||
os.environ['PATH'] += os.pathsep + os.pathsep.join(mac_paths)
|
||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
@@ -757,7 +757,7 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
||||
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">'
|
||||
self.addMessage('<a href="https://github.com/ciromattia/kcc/wiki/Installation#kindlegen">'
|
||||
'Install the kindle-comic-creator cask using Homebrew</a> to enable MOBI conversion',
|
||||
'error')
|
||||
else:
|
||||
@@ -1046,7 +1046,7 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
||||
self.sevenzip = True
|
||||
else:
|
||||
self.sevenzip = False
|
||||
self.addMessage('<a href="https://github.com/ciromattia/kcc/wiki/Installation#7-zip">Install 7z and add to PATH!</a>!'
|
||||
self.addMessage('<a href="https://github.com/ciromattia/kcc/wiki/Installation#7-zip">Cannot find 7z</a>!'
|
||||
' CBZ/CBR/ZIP/etc processing disabled.', 'warning')
|
||||
self.detectKindleGen(True)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
__version__ = '5.6.2'
|
||||
__version__ = '5.6.3'
|
||||
__license__ = 'ISC'
|
||||
__copyright__ = '2012-2022, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>, darodi'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#
|
||||
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
import distro
|
||||
from psutil import Popen
|
||||
from shutil import move
|
||||
@@ -65,6 +67,11 @@ class ComicArchive:
|
||||
process.communicate()
|
||||
if process.returncode != 0:
|
||||
raise OSError('Failed to extract archive.')
|
||||
elif process.returncode != 0 and platform.system() == 'Darwin':
|
||||
process = subprocess.run(f"unar '{self.filepath}' -f -o '{targetdir}'",
|
||||
stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
|
||||
if process.returncode != 0:
|
||||
raise Exception(process.stdout.decode("utf-8"))
|
||||
elif process.returncode != 0:
|
||||
raise OSError('Failed to extract archive. Check if p7zip-rar is installed.')
|
||||
tdir = os.listdir(targetdir)
|
||||
|
||||
BIN
other/osx/7z
BIN
other/osx/7z
Binary file not shown.
BIN
other/osx/7z.so
BIN
other/osx/7z.so
Binary file not shown.
@@ -1,72 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Kindle Comic Converter</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>cbz</string>
|
||||
<string>cbr</string>
|
||||
<string>cb7</string>
|
||||
<string>zip</string>
|
||||
<string>rar</string>
|
||||
<string>7z</string>
|
||||
<string>pdf</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>comic2ebook.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Comics</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>MacOS/Kindle Comic Converter</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>KindleComicConverter 5.5.2, written 2012-2019 by Ciro Mattia Gonano and Pawel Jastrzebski</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>comic2ebook.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.kindlecomicconverter.KindleComicConverter</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Kindle Comic Converter</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.5.2</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>5.5.2</string>
|
||||
<key>LSEnvironment</key>
|
||||
<dict>
|
||||
<key>PATH</key>
|
||||
<string>./../Resources:/Applications/Kindle Comic Creator/Kindle Comic Creator.app/Contents/MacOS:/usr/local/bin:/usr/bin:/bin</string>
|
||||
</dict>
|
||||
<key>LSHasLocalizedDisplayName</key>
|
||||
<false/>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.14.0</string>
|
||||
<key>NSAppleScriptEnabled</key>
|
||||
<false/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>ISC License (ISCL)</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSRequiresAquaSystemAppearance</key>
|
||||
<string>false</string>
|
||||
<key>NSInitialToolTipDelay</key>
|
||||
<integer>1000</integer>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
other/osx/Rar.so
BIN
other/osx/Rar.so
Binary file not shown.
9
setup.py
9
setup.py
@@ -17,8 +17,6 @@ import setuptools
|
||||
import distutils.cmd
|
||||
from kindlecomicconverter import __version__
|
||||
|
||||
OSX_INFO_PLIST = "other/osx/Info.plist"
|
||||
|
||||
NAME = 'KindleComicConverter'
|
||||
MAIN = 'kcc.py'
|
||||
VERSION = __version__
|
||||
@@ -40,18 +38,11 @@ class BuildBinaryCommand(distutils.cmd.Command):
|
||||
VERSION = __version__
|
||||
if sys.platform == 'darwin':
|
||||
|
||||
with open(OSX_INFO_PLIST, 'r') as file:
|
||||
filedata = file.read()
|
||||
filedata = filedata.replace('5.5.2', VERSION)
|
||||
with open(OSX_INFO_PLIST, 'w') as file:
|
||||
file.write(filedata)
|
||||
|
||||
os.system('pyinstaller -y -F -i icons/comic2ebook.icns -n "Kindle Comic Converter" -w -s kcc.py')
|
||||
os.makedirs('dist/Kindle Comic Converter.app/Contents/Resources/Codecs')
|
||||
shutil.copy('other/osx/7z', 'dist/Kindle Comic Converter.app/Contents/Resources')
|
||||
shutil.copy('other/osx/7z.so', 'dist/Kindle Comic Converter.app/Contents/Resources')
|
||||
shutil.copy('other/osx/Rar.so', 'dist/Kindle Comic Converter.app/Contents/Resources/Codecs')
|
||||
shutil.copy('other/osx/Info.plist', 'dist/Kindle Comic Converter.app/Contents')
|
||||
shutil.copy('LICENSE.txt', 'dist/Kindle Comic Converter.app/Contents/Resources')
|
||||
shutil.copy('other/windows/Additional-LICENSE.txt', 'dist/Kindle Comic Converter.app/Contents/Resources')
|
||||
os.chmod('dist/Kindle Comic Converter.app/Contents/Resources/7z', 0o777)
|
||||
|
||||
Reference in New Issue
Block a user