mirror of
https://github.com/ciromattia/kcc
synced 2026-04-16 14:08:45 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
271a129537 | ||
|
|
23099cee81 | ||
|
|
b957fcf3fe | ||
|
|
187475a424 | ||
|
|
88fd54e2ba | ||
|
|
b23b67bbbe | ||
|
|
9992d895cf | ||
|
|
561951a349 |
@@ -25,11 +25,6 @@ jobs:
|
||||
# - name: build binary
|
||||
# run: |
|
||||
# pyi-makespec -F -i icons\\comic2ebook.ico -n KCC_test -w --noupx kcc.py
|
||||
- name: Package Application
|
||||
uses: JackMcKew/pyinstaller-action-windows@main
|
||||
with:
|
||||
path: .
|
||||
spec: ./kcc.spec
|
||||
- name: Package Application
|
||||
uses: JackMcKew/pyinstaller-action-windows@main
|
||||
with:
|
||||
@@ -43,7 +38,6 @@ jobs:
|
||||
- name: rename binaries
|
||||
run: |
|
||||
version_built=$(cat kindlecomicconverter/__init__.py | grep version | awk '{print $3}' | sed "s/[^.0-9b]//g")
|
||||
mv dist/windows/kcc.exe dist/windows/KCC_${version_built}.exe
|
||||
mv dist/windows/kcc-c2e.exe dist/windows/KCC_c2e_${version_built}.exe
|
||||
mv dist/windows/kcc-c2p.exe dist/windows/KCC_c2p_${version_built}.exe
|
||||
|
||||
|
||||
15
.github/workflows/package-windows.yml
vendored
15
.github/workflows/package-windows.yml
vendored
@@ -41,11 +41,22 @@ jobs:
|
||||
- name: build binary
|
||||
run: |
|
||||
python setup.py build_binary
|
||||
- name: upload build
|
||||
- name: upload-unsigned-artifact
|
||||
id: upload-unsigned-artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: windows-build
|
||||
path: dist/*.exe
|
||||
- id: optional_step_id
|
||||
uses: signpath/github-action-submit-signing-request@v1.1
|
||||
with:
|
||||
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
|
||||
organization-id: '1dc1bad6-4a8c-4f85-af30-5c5d3d392ea6'
|
||||
project-slug: 'kcc'
|
||||
signing-policy-slug: 'release-signing'
|
||||
github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}'
|
||||
wait-for-completion: true
|
||||
output-artifact-directory: 'dist/windows/signed/'
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
@@ -55,4 +66,4 @@ jobs:
|
||||
files: |
|
||||
CHANGELOG.md
|
||||
LICENSE.txt
|
||||
dist/*.exe
|
||||
dist/windows/signed/*.exe
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
<item row="5" column="2">
|
||||
<widget class="QCheckBox" name="disableProcessingBox">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><pre style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Do not process any image, ignore profile and processing options</pre></body></html></string>
|
||||
<string><html><head/><body><p style='white-space:pre'>Do not process any image, ignore profile and processing options.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Disable processing</string>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Resource object code (Python 3)
|
||||
# Created by: object code
|
||||
# Created by: The Resource Compiler for Qt version 6.8.1
|
||||
# Created by: The Resource Compiler for Qt version 6.8.2
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PySide6 import QtCore
|
||||
@@ -11612,51 +11612,51 @@ qt_resource_struct = b"\
|
||||
\x00\x00\x00X\x00\x02\x00\x00\x00\x04\x00\x00\x00\x07\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x01\xc0\x00\x00\x00\x00\x00\x01\x00\x02.\xed\
|
||||
\x00\x00\x01\x88;p\xbcB\
|
||||
\x00\x00\x01\x95\x8bV),\
|
||||
\x00\x00\x01\xfe\x00\x00\x00\x00\x00\x01\x00\x02\x83\x87\
|
||||
\x00\x00\x01\x88;p\xbcB\
|
||||
\x00\x00\x01\x95\x8bV)&\
|
||||
\x00\x00\x01\xea\x00\x00\x00\x00\x00\x01\x00\x02Y\x8c\
|
||||
\x00\x00\x01\x88;p\xbcB\
|
||||
\x00\x00\x01\x95\x8bV)&\
|
||||
\x00\x00\x01\xd6\x00\x00\x00\x00\x00\x01\x00\x02N)\
|
||||
\x00\x00\x01\x89\x89D9.\
|
||||
\x00\x00\x01\x95\x8bV),\
|
||||
\x00\x00\x00X\x00\x02\x00\x00\x00\x04\x00\x00\x00\x0c\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\xa6\x00\x00\x00\x00\x00\x01\x00\x01(\x97\
|
||||
\x00\x00\x01\x88;p\xbcB\
|
||||
\x00\x00\x01\x95\x8bV),\
|
||||
\x00\x00\x00\xbc\x00\x00\x00\x00\x00\x01\x00\x011\xef\
|
||||
\x00\x00\x01\x94\x1a\xa2\xa2\x92\
|
||||
\x00\x00\x01\x95\x8bV)5\
|
||||
\x00\x00\x00\x8c\x00\x00\x00\x00\x00\x01\x00\x01\x1d\x90\
|
||||
\x00\x00\x01\x88;p\xbcB\
|
||||
\x00\x00\x01\x95\x8bV),\
|
||||
\x00\x00\x00\xd0\x00\x00\x00\x00\x00\x01\x00\x01:\x05\
|
||||
\x00\x00\x01\x88;p\xbcB\
|
||||
\x00\x00\x01\x95\x8bV)4\
|
||||
\x00\x00\x00X\x00\x02\x00\x00\x00\x03\x00\x00\x00\x11\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x02B\x00\x00\x00\x00\x00\x01\x00\x02\xb5\xd3\
|
||||
\x00\x00\x01\x88;p\xbcJ\
|
||||
\x00\x00\x01\x95\x8bV)b\
|
||||
\x00\x00\x02\x14\x00\x00\x00\x00\x00\x01\x00\x02\x9f\xd6\
|
||||
\x00\x00\x01\x88;p\xbcI\
|
||||
\x00\x00\x01\x95\x8bV)Y\
|
||||
\x00\x00\x02*\x00\x00\x00\x00\x00\x01\x00\x02\xa93\
|
||||
\x00\x00\x01\x88;p\xbcI\
|
||||
\x00\x00\x01\x95\x8bV)Y\
|
||||
\x00\x00\x00X\x00\x02\x00\x00\x00\x07\x00\x00\x00\x15\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x01\x1c\x00\x00\x00\x00\x00\x01\x00\x01P\xb1\
|
||||
\x00\x00\x01\x88;p\xbcJ\
|
||||
\x00\x00\x01\x95\x8bV)b\
|
||||
\x00\x00\x012\x00\x00\x00\x00\x00\x01\x00\x01yY\
|
||||
\x00\x00\x01\x88;p\xbcI\
|
||||
\x00\x00\x01\x95\x8bV)Y\
|
||||
\x00\x00\x01\x94\x00\x00\x00\x00\x00\x01\x00\x01\xd2-\
|
||||
\x00\x00\x01\x94\xb4\xd4\xf0a\
|
||||
\x00\x00\x01\x95\x8bV)Y\
|
||||
\x00\x00\x01z\x00\x00\x00\x00\x00\x01\x00\x01\x8c\xe6\
|
||||
\x00\x00\x01\x88;p\xbcH\
|
||||
\x00\x00\x01\x95\x8bV)Y\
|
||||
\x00\x00\x01\x04\x00\x00\x00\x00\x00\x01\x00\x01LR\
|
||||
\x00\x00\x01\x88;p\xbcF\
|
||||
\x00\x00\x01\x95\x8bV)@\
|
||||
\x00\x00\x00\xe8\x00\x00\x00\x00\x00\x01\x00\x01?\xe9\
|
||||
\x00\x00\x01\x88;p\xbcH\
|
||||
\x00\x00\x01\x95\x8bV)Q\
|
||||
\x00\x00\x01T\x00\x00\x00\x00\x00\x01\x00\x01\x82\xb0\
|
||||
\x00\x00\x01\x88;p\xbcH\
|
||||
\x00\x00\x01\x95\x8bV)Y\
|
||||
\x00\x00\x00X\x00\x02\x00\x00\x00\x01\x00\x00\x00\x1d\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00h\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
\x00\x00\x01\x88;p\xbcH\
|
||||
\x00\x00\x01\x95\x8bV)Q\
|
||||
"
|
||||
|
||||
def qInitResources():
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
################################################################################
|
||||
## Form generated from reading UI file 'KCC.ui'
|
||||
##
|
||||
## Created by: Qt User Interface Compiler version 6.8.1
|
||||
## Created by: Qt User Interface Compiler version 6.8.2
|
||||
##
|
||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
################################################################################
|
||||
@@ -424,7 +424,7 @@ class Ui_mainWindow(object):
|
||||
#endif // QT_CONFIG(tooltip)
|
||||
self.qualityBox.setText(QCoreApplication.translate("mainWindow", u"Panel View 4/2/HQ", None))
|
||||
#if QT_CONFIG(tooltip)
|
||||
self.disableProcessingBox.setToolTip(QCoreApplication.translate("mainWindow", u"<html><head/><body><pre style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Do not process any image, ignore profile and processing options</pre></body></html>", None))
|
||||
self.disableProcessingBox.setToolTip(QCoreApplication.translate("mainWindow", u"<html><head/><body><p style='white-space:pre'>Do not process any image, ignore profile and processing options.</p></body></html>", None))
|
||||
#endif // QT_CONFIG(tooltip)
|
||||
self.disableProcessingBox.setText(QCoreApplication.translate("mainWindow", u"Disable processing", None))
|
||||
#if QT_CONFIG(tooltip)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
################################################################################
|
||||
## Form generated from reading UI file 'MetaEditor.ui'
|
||||
##
|
||||
## Created by: Qt User Interface Compiler version 6.8.1
|
||||
## Created by: Qt User Interface Compiler version 6.8.2
|
||||
##
|
||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
################################################################################
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
__version__ = '7.3.1'
|
||||
__version__ = '7.3.3'
|
||||
__license__ = 'ISC'
|
||||
__copyright__ = '2012-2022, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>, darodi'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
@@ -77,14 +77,15 @@ def main(argv=None):
|
||||
return 0
|
||||
|
||||
|
||||
def buildHTML(path, imgfile):
|
||||
def buildHTML(path, imgfile, imgfilepath):
|
||||
key = pathlib.Path(imgfilepath).name
|
||||
filename = getImageFileName(imgfile)
|
||||
deviceres = options.profileData[1]
|
||||
if not options.noprocessing and "Rotated" in imgfile:
|
||||
if not options.noprocessing and "Rotated" in options.imgMetadata[key]:
|
||||
rotatedPage = True
|
||||
else:
|
||||
rotatedPage = False
|
||||
if not options.noprocessing and "BlackBackground" in imgfile:
|
||||
if not options.noprocessing and "BlackBackground" in options.imgMetadata[key]:
|
||||
additionalStyle = 'background-color:#000000;'
|
||||
else:
|
||||
additionalStyle = ''
|
||||
@@ -215,7 +216,7 @@ def buildNCX(dstdir, title, chapters, chapternames):
|
||||
folder = chapter[0].replace(os.path.join(dstdir, 'OEBPS'), '').lstrip('/').lstrip('\\\\')
|
||||
filename = getImageFileName(os.path.join(folder, chapter[1]))
|
||||
navID = folder.replace('/', '_').replace('\\', '_')
|
||||
if options.chapters:
|
||||
if options.comicinfo_chapters:
|
||||
title = chapternames[chapter[1]]
|
||||
navID = filename[0].replace('/', '_').replace('\\', '_')
|
||||
elif os.path.basename(folder) != "Text":
|
||||
@@ -243,7 +244,7 @@ def buildNAV(dstdir, title, chapters, chapternames):
|
||||
for chapter in chapters:
|
||||
folder = chapter[0].replace(os.path.join(dstdir, 'OEBPS'), '').lstrip('/').lstrip('\\\\')
|
||||
filename = getImageFileName(os.path.join(folder, chapter[1]))
|
||||
if options.chapters:
|
||||
if options.comicinfo_chapters:
|
||||
title = chapternames[chapter[1]]
|
||||
elif os.path.basename(folder) != "Text":
|
||||
title = chapternames[os.path.basename(folder)]
|
||||
@@ -255,7 +256,7 @@ def buildNAV(dstdir, title, chapters, chapternames):
|
||||
for chapter in chapters:
|
||||
folder = chapter[0].replace(os.path.join(dstdir, 'OEBPS'), '').lstrip('/').lstrip('\\\\')
|
||||
filename = getImageFileName(os.path.join(folder, chapter[1]))
|
||||
if options.chapters:
|
||||
if options.comicinfo_chapters:
|
||||
title = chapternames[chapter[1]]
|
||||
elif os.path.basename(folder) != "Text":
|
||||
title = chapternames[os.path.basename(folder)]
|
||||
@@ -357,19 +358,19 @@ def buildOPF(dstdir, title, filelist, cover=None):
|
||||
pageside = "right"
|
||||
for entry in reflist:
|
||||
if options.righttoleft:
|
||||
if entry.endswith("-a"):
|
||||
if entry.endswith("-kcc-a"):
|
||||
f.write(
|
||||
"<itemref idref=\"page_%s\" %s/>\n" % (entry,
|
||||
pageSpreadProperty("center"))
|
||||
)
|
||||
pageside = "right"
|
||||
elif entry.endswith("-b"):
|
||||
elif entry.endswith("-kcc-b"):
|
||||
f.write(
|
||||
"<itemref idref=\"page_%s\" %s/>\n" % (entry,
|
||||
pageSpreadProperty("right"))
|
||||
)
|
||||
pageside = "right"
|
||||
elif entry.endswith("-c"):
|
||||
elif entry.endswith("-kcc-c"):
|
||||
f.write(
|
||||
"<itemref idref=\"page_%s\" %s/>\n" % (entry,
|
||||
pageSpreadProperty("left"))
|
||||
@@ -385,19 +386,19 @@ def buildOPF(dstdir, title, filelist, cover=None):
|
||||
else:
|
||||
pageside = "right"
|
||||
else:
|
||||
if entry.endswith("-a"):
|
||||
if entry.endswith("-kcc-a"):
|
||||
f.write(
|
||||
"<itemref idref=\"page_%s\" %s/>\n" % (entry,
|
||||
pageSpreadProperty("center"))
|
||||
)
|
||||
pageside = "left"
|
||||
elif entry.endswith("-b"):
|
||||
elif entry.endswith("-kcc-b"):
|
||||
f.write(
|
||||
"<itemref idref=\"page_%s\" %s/>\n" % (entry,
|
||||
pageSpreadProperty("left"))
|
||||
)
|
||||
pageside = "left"
|
||||
elif entry.endswith("-c"):
|
||||
elif entry.endswith("-kcc-c"):
|
||||
f.write(
|
||||
"<itemref idref=\"page_%s\" %s/>\n" % (entry,
|
||||
pageSpreadProperty("right"))
|
||||
@@ -517,11 +518,14 @@ def buildEPUB(path, chapternames, tomenumber, ischunked):
|
||||
if not chapter:
|
||||
chapterlist.append((dirpath.replace('Images', 'Text'), afile))
|
||||
chapter = True
|
||||
filelist.append(buildHTML(dirpath, afile))
|
||||
filelist.append(buildHTML(dirpath, afile, os.path.join(dirpath, afile)))
|
||||
build_html_end = perf_counter()
|
||||
print(f"buildHTML: {build_html_end - build_html_start} seconds")
|
||||
# Overwrite chapternames if tree is flat and ComicInfo.xml has bookmarks
|
||||
if not chapternames and options.chapters and not ischunked:
|
||||
if ischunked:
|
||||
options.comicinfo_chapters = []
|
||||
|
||||
if not chapternames and options.comicinfo_chapters:
|
||||
chapterlist = []
|
||||
|
||||
global_diff = 0
|
||||
@@ -534,13 +538,13 @@ def buildEPUB(path, chapternames, tomenumber, ischunked):
|
||||
elif options.splitter == 2:
|
||||
diff_delta = 2
|
||||
|
||||
for aChapter in options.chapters:
|
||||
for aChapter in options.comicinfo_chapters:
|
||||
pageid = aChapter[0]
|
||||
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 += diff_delta
|
||||
global_diff += diff_delta
|
||||
|
||||
@@ -556,6 +560,7 @@ def imgDirectoryProcessing(path):
|
||||
global workerPool, workerOutput
|
||||
workerPool = Pool(maxtasksperchild=100)
|
||||
workerOutput = []
|
||||
options.imgMetadata = {}
|
||||
work = []
|
||||
pagenumber = 0
|
||||
for dirpath, _, filenames in os.walk(path):
|
||||
@@ -587,7 +592,10 @@ def imgFileProcessingTick(output):
|
||||
if isinstance(output, tuple):
|
||||
workerOutput.append(output)
|
||||
workerPool.terminate()
|
||||
|
||||
else:
|
||||
for page in output:
|
||||
if page is not None:
|
||||
options.imgMetadata[page[0]] = page[1]
|
||||
if GUI:
|
||||
GUI.progressBarTick.emit('tick')
|
||||
if not GUI.conversionAlive:
|
||||
@@ -708,7 +716,7 @@ def getOutputFilename(srcpath, wantedname, ext, tomenumber):
|
||||
|
||||
def getComicInfo(path, originalpath):
|
||||
xmlPath = os.path.join(path, 'ComicInfo.xml')
|
||||
options.chapters = []
|
||||
options.comicinfo_chapters = []
|
||||
options.summary = ''
|
||||
titleSuffix = ''
|
||||
if options.title == 'defaulttitle':
|
||||
@@ -750,7 +758,7 @@ def getComicInfo(path, originalpath):
|
||||
else:
|
||||
options.authors = ['KCC']
|
||||
if xml.data['Bookmarks']:
|
||||
options.chapters = xml.data['Bookmarks']
|
||||
options.comicinfo_chapters = xml.data['Bookmarks']
|
||||
if xml.data['Summary']:
|
||||
options.summary = hescape(xml.data['Summary'])
|
||||
os.remove(xmlPath)
|
||||
|
||||
@@ -285,26 +285,27 @@ class ComicPage:
|
||||
self.rotated = False
|
||||
self.orgPath = os.path.join(path[0], path[1])
|
||||
if 'N' in mode:
|
||||
self.targetPath = os.path.join(path[0], os.path.splitext(path[1])[0]) + '-KCC'
|
||||
self.targetPath = os.path.join(path[0], os.path.splitext(path[1])[0]) + '-kcc'
|
||||
elif 'R' in mode:
|
||||
self.targetPath = os.path.join(path[0], os.path.splitext(path[1])[0]) + '-KCC-A'
|
||||
self.targetPath = os.path.join(path[0], os.path.splitext(path[1])[0]) + '-kcc-a'
|
||||
self.rotated = True
|
||||
elif 'S1' in mode:
|
||||
self.targetPath = os.path.join(path[0], os.path.splitext(path[1])[0]) + '-KCC-B'
|
||||
self.targetPath = os.path.join(path[0], os.path.splitext(path[1])[0]) + '-kcc-b'
|
||||
elif 'S2' in mode:
|
||||
self.targetPath = os.path.join(path[0], os.path.splitext(path[1])[0]) + '-KCC-C'
|
||||
self.targetPath = os.path.join(path[0], os.path.splitext(path[1])[0]) + '-kcc-c'
|
||||
# backwards compatibility for Pillow >9.1.0
|
||||
if not hasattr(Image, 'Resampling'):
|
||||
Image.Resampling = Image
|
||||
|
||||
def saveToDir(self):
|
||||
try:
|
||||
flags = []
|
||||
if not self.opt.forcecolor and not self.opt.forcepng:
|
||||
self.image = self.image.convert('L')
|
||||
if self.rotated:
|
||||
self.targetPath += '-Rotated'
|
||||
flags.append('Rotated')
|
||||
if self.fill != 'white':
|
||||
self.targetPath += '-BlackBackground'
|
||||
flags.append('BlackBackground')
|
||||
if self.opt.forcepng:
|
||||
self.image.info["transparency"] = None
|
||||
self.targetPath += '.png'
|
||||
@@ -322,7 +323,7 @@ class ComicPage:
|
||||
self.image.save(self.targetPath, 'JPEG', optimize=1, quality=85)
|
||||
if os.path.isfile(self.orgPath):
|
||||
os.remove(self.orgPath)
|
||||
return Path(self.targetPath).name
|
||||
return [Path(self.targetPath).name, flags]
|
||||
except IOError as err:
|
||||
raise RuntimeError('Cannot save image. ' + str(err))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user