From ee5bd150e5ae456053eb1a3514f40ea9357ddb38 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Tue, 23 Jun 2026 17:24:11 -0700 Subject: [PATCH] add force ebok option --- README.md | 5 ++-- gui/KCC.ui | 36 +++++++++++++++++++++-------- kindlecomicconverter/KCC_gui.py | 3 +++ kindlecomicconverter/KCC_ui.py | 29 +++++++++++++++-------- kindlecomicconverter/comic2ebook.py | 4 ++++ 5 files changed, 56 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 7c64e10..8264376 100644 --- a/README.md +++ b/README.md @@ -239,10 +239,11 @@ MAIN: Device profile (Available options: K1, K2, K34, K578, KDX, KPW, KPW5, KV, KO, K11, KS, KoMT, KoG, KoGHD, KoA, KoAHD, KoAH2O, KoAO, KoN, KoC, KoCC, KoL, KoLC, KoF, KoS, KoE) [Default=KV] -m, --manga-style Manga style (right-to-left reading and splitting) - -invertdirection Invert page turn direction + --ebok Force EBOK tag instead of PDOC for MOBI + --invertdirection Invert page turn direction -q, --hq Try to increase the quality of magnification -2, --two-panel Display two not four panels in Panel View mode - -vertical4panel Show side panels first in virtual panel view + --vertical4panel Show side panels first in virtual panel view -w, --webtoon Webtoon processing mode --ts TARGETSIZE, --targetsize TARGETSIZE the maximal size of output file in MB. [Default=100MB for webtoon and 400MB for others] diff --git a/gui/KCC.ui b/gui/KCC.ui index 3544666..2b7e9a6 100644 --- a/gui/KCC.ui +++ b/gui/KCC.ui @@ -635,16 +635,6 @@ Higher values are larger and higher quality, and may resolve blank page issues.< - - - - <html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Unchecked - Main Drive<br/></span>Use dedicated temporary directory on main OS drive.</p><p><span style=" font-weight:600; text-decoration: underline;">Checked - Source File Drive<br/></span>Create temporary file directory on source file drive.</p></body></html> - - - Temp Directory - - - @@ -966,12 +956,38 @@ Ignored for Kindle EPUB/MOBI and all PDF. 0 + + Qt::FocusPolicy::ClickFocus + <html><head/><body><p>Default EPUB language is en-US.</p><p>Only use if your EPUB reader has problems with English fonts.</p></body></html> EPUB language + + false + + + + + + + <html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Unchecked - Main Drive<br/></span>Use dedicated temporary directory on main OS drive.</p><p><span style=" font-weight:600; text-decoration: underline;">Checked - Source File Drive<br/></span>Create temporary file directory on source file drive.</p></body></html> + + + Temp Directory + + + + + + + <html><head/><body><p>Force Kindle MOBI to be be tagged as EBOK instead of PDOC.</p><p>This may cause USB loaded books to be deleted if you go online after a month offline.</p></body></html> + + + Force EBOK + diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py index 3cb1c14..3e799dd 100644 --- a/kindlecomicconverter/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -273,6 +273,8 @@ class WorkerThread(QThread): options.format = gui_current_format if GUI.mangaBox.isChecked(): options.righttoleft = True + if GUI.ebokBox.isChecked(): + options.ebok = True if GUI.invertDirectionBox.isChecked(): options.invertdirection = True if GUI.rotateBox.checkState() == Qt.CheckState.PartiallyChecked: @@ -1086,6 +1088,7 @@ class KCCGUI(KCC_ui.Ui_mainWindow): self.settings.setValue('startNumber', self.startNumber + 1) self.settings.setValue('windowSize', str(MW.size().width()) + 'x' + str(MW.size().height())) self.settings.setValue('options', {'mangaBox': GUI.mangaBox.checkState(), + 'ebokBox': GUI.ebokBox.checkState(), 'invertDirectionBox': GUI.invertDirectionBox.checkState(), 'languageEdit': GUI.languageEdit.text(), 'rotateBox': GUI.rotateBox.checkState(), diff --git a/kindlecomicconverter/KCC_ui.py b/kindlecomicconverter/KCC_ui.py index f91dedf..26c17ba 100644 --- a/kindlecomicconverter/KCC_ui.py +++ b/kindlecomicconverter/KCC_ui.py @@ -339,11 +339,6 @@ class Ui_mainWindow(object): self.gridLayout_2.addWidget(self.vertical4PanelBox, 9, 2, 1, 1) - self.tempDirBox = QCheckBox(self.optionWidget) - self.tempDirBox.setObjectName(u"tempDirBox") - - self.gridLayout_2.addWidget(self.tempDirBox, 10, 3, 1, 1) - self.onePageLandscapeBox = QCheckBox(self.optionWidget) self.onePageLandscapeBox.setObjectName(u"onePageLandscapeBox") @@ -492,9 +487,21 @@ class Ui_mainWindow(object): self.languageEdit.setObjectName(u"languageEdit") sizePolicy3.setHeightForWidth(self.languageEdit.sizePolicy().hasHeightForWidth()) self.languageEdit.setSizePolicy(sizePolicy3) + self.languageEdit.setFocusPolicy(Qt.FocusPolicy.ClickFocus) + self.languageEdit.setClearButtonEnabled(False) self.gridLayout_2.addWidget(self.languageEdit, 0, 3, 1, 1) + self.tempDirBox = QCheckBox(self.optionWidget) + self.tempDirBox.setObjectName(u"tempDirBox") + + self.gridLayout_2.addWidget(self.tempDirBox, 10, 2, 1, 1) + + self.ebokBox = QCheckBox(self.optionWidget) + self.ebokBox.setObjectName(u"ebokBox") + + self.gridLayout_2.addWidget(self.ebokBox, 10, 3, 1, 1) + self.gridLayout.addWidget(self.optionWidget, 5, 0, 1, 2) @@ -759,10 +766,6 @@ class Ui_mainWindow(object): self.vertical4PanelBox.setToolTip(QCoreApplication.translate("mainWindow", u"

In virtual panel mode:

Unchecked - Horizontal
First two panels are the top panels.

Checked - Vertical
First two panels are the side panels.

", None)) #endif // QT_CONFIG(tooltip) self.vertical4PanelBox.setText(QCoreApplication.translate("mainWindow", u"Vertical 4 Panel", None)) -#if QT_CONFIG(tooltip) - self.tempDirBox.setToolTip(QCoreApplication.translate("mainWindow", u"

Unchecked - Main Drive
Use dedicated temporary directory on main OS drive.

Checked - Source File Drive
Create temporary file directory on source file drive.

", None)) -#endif // QT_CONFIG(tooltip) - self.tempDirBox.setText(QCoreApplication.translate("mainWindow", u"Temp Directory", None)) #if QT_CONFIG(tooltip) self.onePageLandscapeBox.setToolTip(QCoreApplication.translate("mainWindow", u"

Unchecked - 2 page landscape
2 viewports for left and right pages

Checked - 1 page landscape
A single centered viewport for 1 page

", None)) #endif // QT_CONFIG(tooltip) @@ -866,6 +869,14 @@ class Ui_mainWindow(object): self.languageEdit.setToolTip(QCoreApplication.translate("mainWindow", u"

Default EPUB language is en-US.

Only use if your EPUB reader has problems with English fonts.

", None)) #endif // QT_CONFIG(tooltip) self.languageEdit.setPlaceholderText(QCoreApplication.translate("mainWindow", u"EPUB language", None)) +#if QT_CONFIG(tooltip) + self.tempDirBox.setToolTip(QCoreApplication.translate("mainWindow", u"

Unchecked - Main Drive
Use dedicated temporary directory on main OS drive.

Checked - Source File Drive
Create temporary file directory on source file drive.

", None)) +#endif // QT_CONFIG(tooltip) + self.tempDirBox.setText(QCoreApplication.translate("mainWindow", u"Temp Directory", None)) +#if QT_CONFIG(tooltip) + self.ebokBox.setToolTip(QCoreApplication.translate("mainWindow", u"

Force Kindle MOBI to be be tagged as EBOK instead of PDOC.

This may cause USB loaded books to be deleted if you go online after a month offline.

", None)) +#endif // QT_CONFIG(tooltip) + self.ebokBox.setText(QCoreApplication.translate("mainWindow", u"Force EBOK", None)) #if QT_CONFIG(tooltip) self.hLabel.setToolTip(QCoreApplication.translate("mainWindow", u"

Resolution of the target device.

", None)) #endif // QT_CONFIG(tooltip) diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index 471c6f5..86fcbbc 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -1449,6 +1449,8 @@ def makeParser(): " [Default=KV]") main_options.add_argument("-m", "--manga-style", action="store_true", dest="righttoleft", default=False, help="Manga style (right-to-left reading and splitting)") + main_options.add_argument("--ebok", action="store_true", dest="ebok", default=False, + help="Force EBOK tag instead of PDOC for MOBI") main_options.add_argument("--invertdirection", action="store_true", dest="invertdirection", default=False, help="Invert page turn direction") main_options.add_argument("-q", "--hq", action="store_true", dest="hq", default=False, @@ -1938,6 +1940,8 @@ def makeBook(source, qtgui=None, job_progress=''): def makeMOBIFix(item, uuid): is_pdoc = options.profile in image.ProfileData.ProfilesKindlePDOC.keys() + if options.ebok: + is_pdoc = False if not options.keep_epub: os.remove(item) mobiPath = item.replace('.epub', '.mobi')