mirror of
https://github.com/ciromattia/kcc
synced 2025-12-20 13:11:47 +00:00
Merge branch 'ciromattia:master' into pyqt6
This commit is contained in:
7
kcc.py
7
kcc.py
@@ -34,19 +34,20 @@ if sys.platform.startswith('darwin'):
|
|||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
os.environ['PATH'] += os.pathsep + os.pathsep.join(mac_paths +
|
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/local/bin',
|
||||||
'/usr/bin',
|
'/usr/bin',
|
||||||
'/bin',
|
'/bin',
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
os.chdir(os.path.dirname(os.path.abspath(sys.executable)) + '/../Resources')
|
os.chdir(os.path.dirname(os.path.abspath(sys.executable)))
|
||||||
else:
|
else:
|
||||||
os.environ['PATH'] += os.pathsep + os.pathsep.join(mac_paths)
|
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 = [
|
win_paths = [
|
||||||
'%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\',
|
os.path.expandvars('%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\'),
|
||||||
|
os.path.expandvars('%LOCALAPPDATA%\\Amazon\\KC2'),
|
||||||
'C:\\Program Files\\7-Zip',
|
'C:\\Program Files\\7-Zip',
|
||||||
]
|
]
|
||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from urllib.parse import unquote
|
from urllib.parse import unquote
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
@@ -644,6 +645,7 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
|||||||
if not GUI.webtoonBox.isChecked():
|
if not GUI.webtoonBox.isChecked():
|
||||||
GUI.qualityBox.setEnabled(profile['PVOptions'])
|
GUI.qualityBox.setEnabled(profile['PVOptions'])
|
||||||
GUI.upscaleBox.setChecked(profile['DefaultUpscale'])
|
GUI.upscaleBox.setChecked(profile['DefaultUpscale'])
|
||||||
|
GUI.mangaBox.setChecked(True)
|
||||||
if not profile['PVOptions']:
|
if not profile['PVOptions']:
|
||||||
GUI.qualityBox.setChecked(False)
|
GUI.qualityBox.setChecked(False)
|
||||||
if str(GUI.deviceBox.currentText()) == 'Other':
|
if str(GUI.deviceBox.currentText()) == 'Other':
|
||||||
@@ -757,7 +759,7 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
|||||||
if sys.platform.startswith('win'):
|
if sys.platform.startswith('win'):
|
||||||
self.addMessage('Download it and place EXE in KCC directory.', 'error')
|
self.addMessage('Download it and place EXE in KCC directory.', 'error')
|
||||||
elif sys.platform.startswith('darwin'):
|
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',
|
'Install the kindle-comic-creator cask using Homebrew</a> to enable MOBI conversion',
|
||||||
'error')
|
'error')
|
||||||
else:
|
else:
|
||||||
@@ -859,6 +861,12 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
|||||||
self.addMessage('Your <a href="https://www.amazon.com/b?node=23496309011">KindleGen</a>'
|
self.addMessage('Your <a href="https://www.amazon.com/b?node=23496309011">KindleGen</a>'
|
||||||
' is outdated! MOBI conversion might fail.', 'warning')
|
' is outdated! MOBI conversion might fail.', 'warning')
|
||||||
break
|
break
|
||||||
|
where_command = 'where kindlegen.exe'
|
||||||
|
if os.name == 'posix':
|
||||||
|
where_command = 'which kindlegen'
|
||||||
|
process = subprocess.run(where_command, stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
|
||||||
|
locations = process.stdout.decode('utf-8').split('\n')
|
||||||
|
self.addMessage(f"<b>KindleGen Found:</b> {locations[0]}", 'info')
|
||||||
else:
|
else:
|
||||||
self.kindleGen = False
|
self.kindleGen = False
|
||||||
if startup:
|
if startup:
|
||||||
@@ -932,7 +940,7 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
|||||||
"Kindle Voyage": {'PVOptions': True, 'ForceExpert': False, 'DefaultFormat': 0,
|
"Kindle Voyage": {'PVOptions': True, 'ForceExpert': False, 'DefaultFormat': 0,
|
||||||
'DefaultUpscale': True, 'Label': 'KV'},
|
'DefaultUpscale': True, 'Label': 'KV'},
|
||||||
"Kindle Scribe": {
|
"Kindle Scribe": {
|
||||||
'PVOptions': True, 'ForceExpert': False, 'DefaultFormat': 0, 'DefaultUpscale': True, 'Label': 'KS',
|
'PVOptions': True, 'ForceExpert': False, 'DefaultFormat': 0, 'DefaultUpscale': False, 'Label': 'KS',
|
||||||
},
|
},
|
||||||
"Kindle 11": {
|
"Kindle 11": {
|
||||||
'PVOptions': True, 'ForceExpert': False, 'DefaultFormat': 0, 'DefaultUpscale': True, 'Label': 'K11',
|
'PVOptions': True, 'ForceExpert': False, 'DefaultFormat': 0, 'DefaultUpscale': True, 'Label': 'K11',
|
||||||
@@ -1046,7 +1054,7 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
|||||||
self.sevenzip = True
|
self.sevenzip = True
|
||||||
else:
|
else:
|
||||||
self.sevenzip = False
|
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')
|
' CBZ/CBR/ZIP/etc processing disabled.', 'warning')
|
||||||
self.detectKindleGen(True)
|
self.detectKindleGen(True)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
__version__ = '5.6.2'
|
__version__ = '5.6.3'
|
||||||
__license__ = 'ISC'
|
__license__ = 'ISC'
|
||||||
__copyright__ = '2012-2022, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>, darodi'
|
__copyright__ = '2012-2022, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>, darodi'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|||||||
@@ -291,13 +291,14 @@ def buildOPF(dstdir, title, filelist, cover=None):
|
|||||||
"<meta name=\"zero-gutter\" content=\"true\"/>\n",
|
"<meta name=\"zero-gutter\" content=\"true\"/>\n",
|
||||||
"<meta name=\"zero-margin\" content=\"true\"/>\n",
|
"<meta name=\"zero-margin\" content=\"true\"/>\n",
|
||||||
"<meta name=\"ke-border-color\" content=\"#FFFFFF\"/>\n",
|
"<meta name=\"ke-border-color\" content=\"#FFFFFF\"/>\n",
|
||||||
"<meta name=\"ke-border-width\" content=\"0\"/>\n"])
|
"<meta name=\"ke-border-width\" content=\"0\"/>\n",
|
||||||
|
"<meta property=\"rendition:spread\">landscape</meta>\n",
|
||||||
|
"<meta property=\"rendition:layout\">pre-paginated</meta>\n",
|
||||||
|
"<meta name=\"orientation-lock\" content=\"none\"/>\n"])
|
||||||
if options.kfx:
|
if options.kfx:
|
||||||
f.writelines(["<meta name=\"orientation-lock\" content=\"none\"/>\n",
|
f.writelines(["<meta name=\"region-mag\" content=\"false\"/>\n"])
|
||||||
"<meta name=\"region-mag\" content=\"false\"/>\n"])
|
|
||||||
else:
|
else:
|
||||||
f.writelines(["<meta name=\"orientation-lock\" content=\"portrait\"/>\n",
|
f.writelines(["<meta name=\"region-mag\" content=\"true\"/>\n"])
|
||||||
"<meta name=\"region-mag\" content=\"true\"/>\n"])
|
|
||||||
elif options.supportSyntheticSpread:
|
elif options.supportSyntheticSpread:
|
||||||
f.writelines([
|
f.writelines([
|
||||||
"<meta property=\"rendition:spread\">landscape</meta>\n",
|
"<meta property=\"rendition:spread\">landscape</meta>\n",
|
||||||
@@ -509,18 +510,30 @@ def buildEPUB(path, chapternames, tomenumber):
|
|||||||
# Overwrite chapternames if tree is flat and ComicInfo.xml has bookmarks
|
# Overwrite chapternames if tree is flat and ComicInfo.xml has bookmarks
|
||||||
if not chapternames and options.chapters:
|
if not chapternames and options.chapters:
|
||||||
chapterlist = []
|
chapterlist = []
|
||||||
globaldiff = 0
|
|
||||||
|
global_diff = 0
|
||||||
|
diff_delta = 0
|
||||||
|
|
||||||
|
# if split
|
||||||
|
if options.splitter == 0:
|
||||||
|
diff_delta = 1
|
||||||
|
# if rotate and split
|
||||||
|
elif options.splitter == 2:
|
||||||
|
diff_delta = 2
|
||||||
|
|
||||||
for aChapter in options.chapters:
|
for aChapter in options.chapters:
|
||||||
pageid = aChapter[0]
|
pageid = aChapter[0]
|
||||||
for x in range(0, pageid + globaldiff + 1):
|
cur_diff = global_diff
|
||||||
|
global_diff = 0
|
||||||
|
|
||||||
|
for x in range(0, pageid + cur_diff + 1):
|
||||||
if '-kcc-b' in filelist[x][1]:
|
if '-kcc-b' in filelist[x][1]:
|
||||||
pageid += 1
|
pageid += diff_delta
|
||||||
if '-kcc-c' in filelist[pageid][1]:
|
global_diff += diff_delta
|
||||||
pageid -= 1
|
|
||||||
filename = filelist[pageid][1]
|
filename = filelist[pageid][1]
|
||||||
chapterlist.append((filelist[pageid][0].replace('Images', 'Text'), filename))
|
chapterlist.append((filelist[pageid][0].replace('Images', 'Text'), filename))
|
||||||
chapternames[filename] = aChapter[1]
|
chapternames[filename] = aChapter[1]
|
||||||
globaldiff = pageid - (aChapter[0] + globaldiff)
|
|
||||||
buildNCX(path, options.title, chapterlist, chapternames)
|
buildNCX(path, options.title, chapterlist, chapternames)
|
||||||
buildNAV(path, options.title, chapterlist, chapternames)
|
buildNAV(path, options.title, chapterlist, chapternames)
|
||||||
buildOPF(path, options.title, filelist, cover)
|
buildOPF(path, options.title, filelist, cover)
|
||||||
@@ -744,19 +757,23 @@ def getPanelViewSize(deviceres, size):
|
|||||||
def sanitizeTree(filetree):
|
def sanitizeTree(filetree):
|
||||||
chapterNames = {}
|
chapterNames = {}
|
||||||
for root, dirs, files in os.walk(filetree, False):
|
for root, dirs, files in os.walk(filetree, False):
|
||||||
for name in files:
|
for i, name in enumerate(sorted(files)):
|
||||||
splitname = os.path.splitext(name)
|
splitname = os.path.splitext(name)
|
||||||
slugified = slugify(splitname[0], False)
|
|
||||||
while os.path.exists(os.path.join(root, slugified + splitname[1])) and splitname[0].upper()\
|
# file needs kcc at front AND back to avoid renaming issues
|
||||||
!= slugified.upper():
|
slugified = f'kcc-{i:04}'
|
||||||
slugified += "A"
|
for suffix in '-KCC', '-KCC-A', '-KCC-B', '-KCC-C':
|
||||||
|
if splitname[0].endswith(suffix):
|
||||||
|
slugified += suffix.lower()
|
||||||
|
break
|
||||||
|
|
||||||
newKey = os.path.join(root, slugified + splitname[1])
|
newKey = os.path.join(root, slugified + splitname[1])
|
||||||
key = os.path.join(root, name)
|
key = os.path.join(root, name)
|
||||||
if key != newKey:
|
if key != newKey:
|
||||||
os.replace(key, newKey)
|
os.replace(key, newKey)
|
||||||
for name in dirs:
|
for name in dirs:
|
||||||
tmpName = name
|
tmpName = name
|
||||||
slugified = slugify(name, True)
|
slugified = slugify(name)
|
||||||
while os.path.exists(os.path.join(root, slugified)) and name.upper() != slugified.upper():
|
while os.path.exists(os.path.join(root, slugified)) and name.upper() != slugified.upper():
|
||||||
slugified += "A"
|
slugified += "A"
|
||||||
chapterNames[slugified] = tmpName
|
chapterNames[slugified] = tmpName
|
||||||
@@ -767,23 +784,6 @@ def sanitizeTree(filetree):
|
|||||||
return chapterNames
|
return chapterNames
|
||||||
|
|
||||||
|
|
||||||
def sanitizeTreeKobo(filetree):
|
|
||||||
pageNumber = 0
|
|
||||||
for root, dirs, files in os.walk(filetree):
|
|
||||||
dirs, files = walkSort(dirs, files)
|
|
||||||
for name in files:
|
|
||||||
splitname = os.path.splitext(name)
|
|
||||||
slugified = str(pageNumber).zfill(5)
|
|
||||||
pageNumber += 1
|
|
||||||
while os.path.exists(os.path.join(root, slugified + splitname[1])) and splitname[0].upper()\
|
|
||||||
!= slugified.upper():
|
|
||||||
slugified += "A"
|
|
||||||
newKey = os.path.join(root, slugified + splitname[1])
|
|
||||||
key = os.path.join(root, name)
|
|
||||||
if key != newKey:
|
|
||||||
os.replace(key, newKey)
|
|
||||||
|
|
||||||
|
|
||||||
def sanitizePermissions(filetree):
|
def sanitizePermissions(filetree):
|
||||||
for root, dirs, files in os.walk(filetree, False):
|
for root, dirs, files in os.walk(filetree, False):
|
||||||
for name in files:
|
for name in files:
|
||||||
@@ -906,11 +906,8 @@ def createNewTome():
|
|||||||
return tomePath, tomePathRoot
|
return tomePath, tomePathRoot
|
||||||
|
|
||||||
|
|
||||||
def slugify(value, isdir):
|
def slugify(value):
|
||||||
if isdir:
|
|
||||||
value = slugify_ext(value, regex_pattern=r'[^-a-z0-9_\.]+').strip('.')
|
value = slugify_ext(value, regex_pattern=r'[^-a-z0-9_\.]+').strip('.')
|
||||||
else:
|
|
||||||
value = slugify_ext(value).strip('.')
|
|
||||||
value = sub(r'0*([0-9]{4,})', r'\1', sub(r'([0-9]+)', r'0000\1', value, count=2))
|
value = sub(r'0*([0-9]{4,})', r'\1', sub(r'([0-9]+)', r'0000\1', value, count=2))
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@@ -1157,8 +1154,6 @@ def makeBook(source, qtgui=None):
|
|||||||
if GUI:
|
if GUI:
|
||||||
GUI.progressBarTick.emit('1')
|
GUI.progressBarTick.emit('1')
|
||||||
chapterNames = sanitizeTree(os.path.join(path, 'OEBPS', 'Images'))
|
chapterNames = sanitizeTree(os.path.join(path, 'OEBPS', 'Images'))
|
||||||
if 'Ko' in options.profile and options.format == 'CBZ':
|
|
||||||
sanitizeTreeKobo(os.path.join(path, 'OEBPS', 'Images'))
|
|
||||||
if options.batchsplit > 0:
|
if options.batchsplit > 0:
|
||||||
tomes = splitDirectory(path)
|
tomes = splitDirectory(path)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
|
import subprocess
|
||||||
import distro
|
import distro
|
||||||
from psutil import Popen
|
from psutil import Popen
|
||||||
from shutil import move
|
from shutil import move
|
||||||
@@ -65,6 +67,11 @@ class ComicArchive:
|
|||||||
process.communicate()
|
process.communicate()
|
||||||
if process.returncode != 0:
|
if process.returncode != 0:
|
||||||
raise OSError('Failed to extract archive.')
|
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:
|
elif process.returncode != 0:
|
||||||
raise OSError('Failed to extract archive. Check if p7zip-rar is installed.')
|
raise OSError('Failed to extract archive. Check if p7zip-rar is installed.')
|
||||||
tdir = os.listdir(targetdir)
|
tdir = os.listdir(targetdir)
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ import os
|
|||||||
from random import choice
|
from random import choice
|
||||||
from string import ascii_uppercase, digits
|
from string import ascii_uppercase, digits
|
||||||
|
|
||||||
|
# skip stray images a few pixels in size in some PDFs
|
||||||
|
# typical images are many thousands in length
|
||||||
|
# https://github.com/ciromattia/kcc/pull/546
|
||||||
|
STRAY_IMAGE_LENGTH_THRESHOLD = 300
|
||||||
|
|
||||||
|
|
||||||
class PdfJpgExtract:
|
class PdfJpgExtract:
|
||||||
def __init__(self, fname):
|
def __init__(self, fname):
|
||||||
@@ -60,10 +65,15 @@ class PdfJpgExtract:
|
|||||||
raise Exception("Didn't find end of JPG!")
|
raise Exception("Didn't find end of JPG!")
|
||||||
istart += startfix
|
istart += startfix
|
||||||
iend += endfix
|
iend += endfix
|
||||||
|
i = iend
|
||||||
|
|
||||||
|
if iend - istart < STRAY_IMAGE_LENGTH_THRESHOLD:
|
||||||
|
continue
|
||||||
|
|
||||||
jpg = pdf[istart:iend]
|
jpg = pdf[istart:iend]
|
||||||
jpgfile = open(self.path + "/jpg%d.jpg" % njpg, "wb")
|
jpgfile = open(self.path + "/jpg%d.jpg" % njpg, "wb")
|
||||||
jpgfile.write(jpg)
|
jpgfile.write(jpg)
|
||||||
jpgfile.close()
|
jpgfile.close()
|
||||||
njpg += 1
|
njpg += 1
|
||||||
i = iend
|
|
||||||
return self.path, njpg
|
return self.path, njpg
|
||||||
|
|||||||
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.
17
setup.py
17
setup.py
@@ -17,8 +17,6 @@ import setuptools
|
|||||||
import distutils.cmd
|
import distutils.cmd
|
||||||
from kindlecomicconverter import __version__
|
from kindlecomicconverter import __version__
|
||||||
|
|
||||||
OSX_INFO_PLIST = "other/osx/Info.plist"
|
|
||||||
|
|
||||||
NAME = 'KindleComicConverter'
|
NAME = 'KindleComicConverter'
|
||||||
MAIN = 'kcc.py'
|
MAIN = 'kcc.py'
|
||||||
VERSION = __version__
|
VERSION = __version__
|
||||||
@@ -39,22 +37,7 @@ class BuildBinaryCommand(distutils.cmd.Command):
|
|||||||
def run(self):
|
def run(self):
|
||||||
VERSION = __version__
|
VERSION = __version__
|
||||||
if sys.platform == 'darwin':
|
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.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)
|
|
||||||
# TODO /usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime dist/Applications/Kindle\ Comic\ Converter.app -v
|
# TODO /usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime dist/Applications/Kindle\ Comic\ Converter.app -v
|
||||||
os.system('appdmg kcc.json dist/KindleComicConverter_osx_' + VERSION + '.dmg')
|
os.system('appdmg kcc.json dist/KindleComicConverter_osx_' + VERSION + '.dmg')
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user