Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Mac CBZ, CBR, cover upload, damaged #566

Merged
merged 2 commits into from
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions kcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
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__)))
Expand Down
4 changes: 2 additions & 2 deletions kindlecomicconverter/KCC_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ def display_kindlegen_missing(self):
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:
Expand Down Expand Up @@ -1046,7 +1046,7 @@ def __init__(self, kccapp, kccwindow):
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)

Expand Down
2 changes: 1 addition & 1 deletion kindlecomicconverter/__init__.py
Original file line number Diff line number Diff line change
@@ -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'
7 changes: 7 additions & 0 deletions kindlecomicconverter/comicarchive.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#

import os
import platform
import subprocess
import distro
from psutil import Popen
from shutil import move
Expand Down Expand Up @@ -65,6 +67,11 @@ def extract(self, targetdir):
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)
Expand Down
Binary file removed other/osx/7z
Binary file not shown.
Binary file removed other/osx/7z.so
Binary file not shown.
72 changes: 0 additions & 72 deletions other/osx/Info.plist

This file was deleted.

Binary file removed other/osx/Rar.so
Binary file not shown.
9 changes: 0 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import distutils.cmd
from kindlecomicconverter import __version__

OSX_INFO_PLIST = "other/osx/Info.plist"

NAME = 'KindleComicConverter'
MAIN = 'kcc.py'
VERSION = __version__
Expand All @@ -40,18 +38,11 @@ def run(self):
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)
Expand Down