1
0
mirror of https://github.com/ciromattia/kcc synced 2026-04-18 06:58:58 +00:00

Compare commits

...

13 Commits
test ... v6.0.0

Author SHA1 Message Date
Alex Xu
cf38c4d445 Revert "fix package-windows-with-docker.yml (#579)"
This reverts commit 424118b7cd.
2024-04-16 15:46:44 -07:00
Alex Xu
283b2da1a0 bump to 6.0.0 2024-04-16 15:09:03 -07:00
Alex Xu
4a9f693574 Adds --author argument to CLI (#683) 2024-04-16 14:59:54 -07:00
Alex Xu
9a48887edc update C drive notes 2024-04-15 21:16:14 -07:00
Alex Xu
0981ec3c6d add more 7z Windows locations 2024-03-24 18:40:50 -07:00
dependabot[bot]
e0e6606736 Bump softprops/action-gh-release from 1 to 2
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-21 21:58:00 -07:00
Alex Xu
518e67c132 move install from source instructions 2024-03-16 20:12:30 -07:00
Alex Xu
6c593dac1f add gen_ui_files note 2024-03-16 14:04:35 -07:00
Alex Xu
9d065676db add install from source and qt creator instructions 2024-03-16 13:54:40 -07:00
Alex Xu
9520e59a29 Add C drive notes 2024-03-15 12:08:46 -07:00
Alex Xu
461a7fda88 add C drive note 2024-03-12 12:44:07 -07:00
Alex Xu
5ccbb770a6 do not change default install location for 7z/KP 2024-03-09 10:04:01 -08:00
Alex Xu
49bf80f5d8 LOAD_TRUNCATED_IMAGES = True 2024-03-04 21:36:07 -08:00
8 changed files with 84 additions and 24 deletions

View File

@@ -64,7 +64,7 @@ jobs:
name: AppImage name: AppImage
path: './*.AppImage*' path: './*.AppImage*'
- name: Release - name: Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
prerelease: true prerelease: true

View File

@@ -83,7 +83,7 @@ jobs:
name: mac-os-build-${{ runner.arch }} name: mac-os-build-${{ runner.arch }}
path: dist/*.dmg path: dist/*.dmg
- name: Release - name: Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
prerelease: true prerelease: true

View File

@@ -26,17 +26,17 @@ jobs:
# run: | # run: |
# pyi-makespec -F -i icons\\comic2ebook.ico -n KCC_test -w --noupx kcc.py # pyi-makespec -F -i icons\\comic2ebook.ico -n KCC_test -w --noupx kcc.py
- name: Package Application - name: Package Application
uses: JackMcKew/pyinstaller-action-windows@python3-10-pyinstaller-5-3 uses: JackMcKew/pyinstaller-action-windows@main
with: with:
path: . path: .
spec: ./kcc.spec spec: ./kcc.spec
- name: Package Application - name: Package Application
uses: JackMcKew/pyinstaller-action-windows@python3-10-pyinstaller-5-3 uses: JackMcKew/pyinstaller-action-windows@main
with: with:
path: . path: .
spec: ./kcc-c2e.spec spec: ./kcc-c2e.spec
- name: Package Application - name: Package Application
uses: JackMcKew/pyinstaller-action-windows@python3-10-pyinstaller-5-3 uses: JackMcKew/pyinstaller-action-windows@main
with: with:
path: . path: .
spec: ./kcc-c2p.spec spec: ./kcc-c2p.spec
@@ -52,7 +52,7 @@ jobs:
name: windows-build name: windows-build
path: dist/windows/*.exe path: dist/windows/*.exe
- name: Release - name: Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
prerelease: true prerelease: true

View File

@@ -47,7 +47,7 @@ jobs:
name: windows-build name: windows-build
path: dist/*.exe path: dist/*.exe
- name: Release - name: Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
prerelease: true prerelease: true

View File

@@ -55,8 +55,6 @@ For flatpak, Docker, and AppImage versions, refer to the wiki: https://github.co
You'll need to install various tools to access important but optional features. You'll need to install various tools to access important but optional features.
The installation process has been greatly streamlined. No need to add 7z to PATH or locate KindleGen from the internet and put it in a special folder with KCC. Just run it and KCC will tell you what to install.
### 7-Zip ### 7-Zip
#### Windows 7-Zip #### Windows 7-Zip
@@ -66,6 +64,8 @@ First install 7z from https://www.7-zip.org/ or with command line:
winget install --id 7zip.7zip winget install --id 7zip.7zip
``` ```
On Windows, make sure to install the `64-bit x64` version. KCC expects it to be installed to `C:\Program Files\7-Zip` (on the `C:\` drive) which is default.
#### macOS 7-Zip/Unar #### macOS 7-Zip/Unar
with [Homebrew](https://brew.sh/) installed with [Homebrew](https://brew.sh/) installed
``` ```
@@ -77,7 +77,9 @@ brew install unar
#### Windows / macOS KindleGen #### Windows / macOS KindleGen
Install [Kindle Previewer](https://www.amazon.com/Kindle-Previewer/b?ie=UTF8&node=21381691011). KCC will automatically detect KindleGen from it. It's included in [Kindle Previewer](https://www.amazon.com/Kindle-Previewer/b?ie=UTF8&node=21381691011).
On Windows, KCC expects it to be installed on the `C:/` drive, which is by default.
## INPUT FORMATS ## INPUT FORMATS
**KCC** can understand and convert, at the moment, the following input types: **KCC** can understand and convert, at the moment, the following input types:
@@ -130,7 +132,6 @@ sudo apt-get install python3 p7zip-full python3-pil python3-psutil python3-slugi
'OTHER': ("Other", (0, 0), Palette16, 1.8), 'OTHER': ("Other", (0, 0), Palette16, 1.8),
``` ```
### Standalone `kcc-c2e.py` usage: ### Standalone `kcc-c2e.py` usage:
``` ```
@@ -211,6 +212,54 @@ OTHER:
-h, --help Show this help message and exit -h, --help Show this help message and exit
``` ```
## INSTALL FROM SOURCE
This section is for developers who want to contribute to KCC or power users who want to run the latest code without waiting for an official release.
Easiest to use [GitHub Desktop](https://desktop.github.com) to clone the KCC repo. From GitHub Desktop, click on `Repository` in the toolbar, then `Command Prompt` (Windows)/`Terminal` (Mac) to open a window in the KCC repo.
Depending on your system [Python](https://www.python.org) may be called either `python` or `python3`. We use virtual environments (venv) to manage dependencies.
If you want to edit the code, a good code editor is [VS Code](https://code.visualstudio.com).
If you want to edit the `.ui` files, use [Qt Creator](https://www.qt.io/download-qt-installer-oss), included in **Qt for desktop development**.
Then use the `gen_ui_files` scripts to autogenerate the python UI.
### Windows install from source
One time setup and running for the first time:
```
python -m venv venv
venv\Scripts\activate.bat
pip install -r requirements.txt
python kcc.py
```
Every time you close Command Prompt, you will need to re-activate the virtual environment and re-run:
```
venv\Scripts\activate.bat
python kcc.py
```
### macOS install from source
One time setup and running for the first time:
```
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python kcc.py
```
Every time you close Terminal, you will need to reactivate the virtual environment and re-run:
```
source venv/bin/activate
python kcc.py
```
## CREDITS ## CREDITS
**KCC** is made by **KCC** is made by

2
kcc.py
View File

@@ -51,6 +51,8 @@ elif sys.platform.startswith('win'):
os.path.expandvars('%LOCALAPPDATA%\\Amazon\\KC2'), os.path.expandvars('%LOCALAPPDATA%\\Amazon\\KC2'),
os.path.expandvars('%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\'), os.path.expandvars('%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\'),
'C:\\Program Files\\7-Zip', 'C:\\Program Files\\7-Zip',
'D:\\Program Files\\7-Zip',
'E:\\Program Files\\7-Zip',
] ]
if getattr(sys, 'frozen', False): if getattr(sys, 'frozen', False):
os.environ['PATH'] += os.pathsep + os.pathsep.join(win_paths) os.environ['PATH'] += os.pathsep + os.pathsep.join(win_paths)

View File

@@ -1,4 +1,4 @@
__version__ = '5.6.5' __version__ = '6.0.0'
__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'

View File

@@ -21,7 +21,6 @@
import os import os
import pathlib import pathlib
import re import re
import subprocess
import sys import sys
from argparse import ArgumentParser from argparse import ArgumentParser
from time import strftime, gmtime from time import strftime, gmtime
@@ -36,7 +35,7 @@ from multiprocessing import Pool
from uuid import uuid4 from uuid import uuid4
from natsort import os_sorted from natsort import os_sorted
from slugify import slugify as slugify_ext from slugify import slugify as slugify_ext
from PIL import Image from PIL import Image, ImageFile
from subprocess import STDOUT, PIPE from subprocess import STDOUT, PIPE
from psutil import virtual_memory, disk_usage from psutil import virtual_memory, disk_usage
from html import escape as hescape from html import escape as hescape
@@ -51,6 +50,8 @@ from . import metadata
from . import kindle from . import kindle
from . import __version__ from . import __version__
ImageFile.LOAD_TRUNCATED_IMAGES = True
def main(argv=None): def main(argv=None):
global options global options
@@ -688,7 +689,6 @@ def getOutputFilename(srcpath, wantedname, ext, tomenumber):
def getComicInfo(path, originalpath): def getComicInfo(path, originalpath):
xmlPath = os.path.join(path, 'ComicInfo.xml') xmlPath = os.path.join(path, 'ComicInfo.xml')
options.authors = ['KCC']
options.chapters = [] options.chapters = []
options.summary = '' options.summary = ''
titleSuffix = '' titleSuffix = ''
@@ -700,13 +700,18 @@ def getComicInfo(path, originalpath):
options.title = os.path.splitext(os.path.basename(originalpath))[0] options.title = os.path.splitext(os.path.basename(originalpath))[0]
else: else:
defaultTitle = False defaultTitle = False
if options.author == 'defaultauthor':
defaultAuthor = True
options.authors = ['KCC']
else:
defaultAuthor = False
options.authors = [options.author]
if os.path.exists(xmlPath): if os.path.exists(xmlPath):
try: try:
xml = metadata.MetadataParser(xmlPath) xml = metadata.MetadataParser(xmlPath)
except Exception: except Exception:
os.remove(xmlPath) os.remove(xmlPath)
return return
options.authors = []
if xml.data['Title']: if xml.data['Title']:
options.title = hescape(xml.data['Title']) options.title = hescape(xml.data['Title'])
elif defaultTitle: elif defaultTitle:
@@ -717,14 +722,16 @@ def getComicInfo(path, originalpath):
if xml.data['Number']: if xml.data['Number']:
titleSuffix += ' #' + xml.data['Number'].zfill(3) titleSuffix += ' #' + xml.data['Number'].zfill(3)
options.title += titleSuffix options.title += titleSuffix
for field in ['Writers', 'Pencillers', 'Inkers', 'Colorists']: if defaultAuthor:
for person in xml.data[field]: options.authors = []
options.authors.append(hescape(person)) for field in ['Writers', 'Pencillers', 'Inkers', 'Colorists']:
if len(options.authors) > 0: for person in xml.data[field]:
options.authors = list(set(options.authors)) options.authors.append(hescape(person))
options.authors.sort() if len(options.authors) > 0:
else: options.authors = list(set(options.authors))
options.authors = ['KCC'] options.authors.sort()
else:
options.authors = ['KCC']
if xml.data['Bookmarks'] and options.batchsplit == 0: if xml.data['Bookmarks'] and options.batchsplit == 0:
options.chapters = xml.data['Bookmarks'] options.chapters = xml.data['Bookmarks']
if xml.data['Summary']: if xml.data['Summary']:
@@ -963,6 +970,8 @@ def makeParser():
help="Output generated file to specified directory or file") help="Output generated file to specified directory or file")
output_options.add_argument("-t", "--title", action="store", dest="title", default="defaulttitle", output_options.add_argument("-t", "--title", action="store", dest="title", default="defaulttitle",
help="Comic title [Default=filename or directory name]") help="Comic title [Default=filename or directory name]")
output_options.add_argument("-a", "--author", action="store", dest="author", default="defaultauthor",
help="Author name [Default=KCC]")
output_options.add_argument("-f", "--format", action="store", dest="format", default="Auto", output_options.add_argument("-f", "--format", action="store", dest="format", default="Auto",
help="Output format (Available options: Auto, MOBI, EPUB, CBZ, KFX, MOBI+EPUB) " help="Output format (Available options: Auto, MOBI, EPUB, CBZ, KFX, MOBI+EPUB) "
"[Default=Auto]") "[Default=Auto]")