mirror of
https://github.com/ciromattia/kcc
synced 2025-12-16 03:06:33 +00:00
Merge pull request #1101 from kiryl85/update-title-generation
Update title generation
This commit is contained in:
@@ -259,7 +259,7 @@ OUTPUT SETTINGS:
|
|||||||
Output generated file to specified directory or file
|
Output generated file to specified directory or file
|
||||||
-t TITLE, --title TITLE
|
-t TITLE, --title TITLE
|
||||||
Comic title [Default=filename or directory name]
|
Comic title [Default=filename or directory name]
|
||||||
--metadatatitle Write title from ComicInfo.xml or other embedded metadata
|
--metadatatitle Write title using ComicInfo.xml or other embedded metadata. 0: Don't use Title from metadata 1: Combine Title with default schema 2: Use Title only [Default=0]
|
||||||
-a AUTHOR, --author AUTHOR
|
-a AUTHOR, --author AUTHOR
|
||||||
Author name [Default=KCC]
|
Author name [Default=KCC]
|
||||||
-f FORMAT, --format FORMAT
|
-f FORMAT, --format FORMAT
|
||||||
|
|||||||
27
gui/KCC.ui
27
gui/KCC.ui
@@ -516,6 +516,28 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
<widget class="QLineEdit" name="titleEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::FocusPolicy::ClickFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Default Title</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Default Title</string>
|
||||||
|
</property>
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
<widget class="QLineEdit" name="authorEdit">
|
<widget class="QLineEdit" name="authorEdit">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
@@ -593,11 +615,14 @@
|
|||||||
<item row="7" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QCheckBox" name="metadataTitleBox">
|
<widget class="QCheckBox" name="metadataTitleBox">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Write Title from ComicInfo.xml or other embedded metadata.</p></body></html></string>
|
<string><html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Unchecked - Don't use metadata Title<br/></span>Write default title.</p><p><span style=" font-weight:600; text-decoration: underline;">Indeterminate - Add metadata Title to the default schema<br/></span>Write default title with Title from ComicInfo.xml or other embedded metadata.</p><p><span style=" font-weight:600; text-decoration: underline;">Checked - Use metadata Title only<br/></span>Write Title from ComicInfo.xml or other embedded metadata.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Metadata Title</string>
|
<string>Metadata Title</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="tristate">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="2">
|
||||||
|
|||||||
@@ -321,8 +321,10 @@ class WorkerThread(QThread):
|
|||||||
options.maximizestrips = True
|
options.maximizestrips = True
|
||||||
if GUI.disableProcessingBox.isChecked():
|
if GUI.disableProcessingBox.isChecked():
|
||||||
options.noprocessing = True
|
options.noprocessing = True
|
||||||
if GUI.metadataTitleBox.isChecked():
|
if GUI.metadataTitleBox.checkState() == Qt.CheckState.PartiallyChecked:
|
||||||
options.metadatatitle = True
|
options.metadatatitle = 1
|
||||||
|
elif GUI.metadataTitleBox.checkState() == Qt.CheckState.Checked:
|
||||||
|
options.metadatatitle = 2
|
||||||
if GUI.deleteBox.isChecked():
|
if GUI.deleteBox.isChecked():
|
||||||
options.delete = True
|
options.delete = True
|
||||||
if GUI.spreadShiftBox.isChecked():
|
if GUI.spreadShiftBox.isChecked():
|
||||||
@@ -344,6 +346,8 @@ class WorkerThread(QThread):
|
|||||||
options.customheight = str(GUI.heightBox.value())
|
options.customheight = str(GUI.heightBox.value())
|
||||||
if GUI.targetDirectory != '':
|
if GUI.targetDirectory != '':
|
||||||
options.output = GUI.targetDirectory
|
options.output = GUI.targetDirectory
|
||||||
|
if GUI.titleEdit.text():
|
||||||
|
options.title = str(GUI.titleEdit.text())
|
||||||
if GUI.authorEdit.text():
|
if GUI.authorEdit.text():
|
||||||
options.author = str(GUI.authorEdit.text())
|
options.author = str(GUI.authorEdit.text())
|
||||||
if GUI.chunkSizeCheckBox.isChecked():
|
if GUI.chunkSizeCheckBox.isChecked():
|
||||||
@@ -367,6 +371,11 @@ class WorkerThread(QThread):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('Fusion Failed. ' + str(e))
|
print('Fusion Failed. ' + str(e))
|
||||||
MW.addMessage.emit('Fusion Failed. ' + str(e), 'error', True)
|
MW.addMessage.emit('Fusion Failed. ' + str(e), 'error', True)
|
||||||
|
elif len(currentJobs) > 1 and options.title != 'defaulttitle':
|
||||||
|
currentJobs.clear()
|
||||||
|
error_message = 'Process Failed. Custom title can\'t be set when processing more than 1 source.\nDid you forget to check fusion?'
|
||||||
|
print(error_message)
|
||||||
|
MW.addMessage.emit(error_message, 'error', True)
|
||||||
for job in currentJobs:
|
for job in currentJobs:
|
||||||
sleep(0.5)
|
sleep(0.5)
|
||||||
if not self.conversionAlive:
|
if not self.conversionAlive:
|
||||||
@@ -743,6 +752,21 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
|||||||
def togglechunkSizeCheckBox(self, value):
|
def togglechunkSizeCheckBox(self, value):
|
||||||
GUI.chunkSizeWidget.setVisible(value)
|
GUI.chunkSizeWidget.setVisible(value)
|
||||||
|
|
||||||
|
def toggletitleEdit(self, value):
|
||||||
|
if value:
|
||||||
|
self.metadataTitleBox.setChecked(False)
|
||||||
|
|
||||||
|
def togglefileFusionBox(self, value):
|
||||||
|
if value:
|
||||||
|
GUI.metadataTitleBox.setChecked(False)
|
||||||
|
GUI.metadataTitleBox.setEnabled(False)
|
||||||
|
else:
|
||||||
|
GUI.metadataTitleBox.setEnabled(True)
|
||||||
|
|
||||||
|
def togglemetadataTitleBox(self, value):
|
||||||
|
if value:
|
||||||
|
GUI.titleEdit.setText(None)
|
||||||
|
|
||||||
def changeGamma(self, value):
|
def changeGamma(self, value):
|
||||||
valueRaw = int(5 * round(float(value) / 5))
|
valueRaw = int(5 * round(float(value) / 5))
|
||||||
value = '%.2f' % (float(valueRaw) / 100)
|
value = '%.2f' % (float(valueRaw) / 100)
|
||||||
@@ -1255,6 +1279,9 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
|||||||
GUI.chunkSizeCheckBox.stateChanged.connect(self.togglechunkSizeCheckBox)
|
GUI.chunkSizeCheckBox.stateChanged.connect(self.togglechunkSizeCheckBox)
|
||||||
GUI.deviceBox.activated.connect(self.changeDevice)
|
GUI.deviceBox.activated.connect(self.changeDevice)
|
||||||
GUI.formatBox.activated.connect(self.changeFormat)
|
GUI.formatBox.activated.connect(self.changeFormat)
|
||||||
|
GUI.titleEdit.textChanged.connect(self.toggletitleEdit)
|
||||||
|
GUI.fileFusionBox.stateChanged.connect(self.togglefileFusionBox)
|
||||||
|
GUI.metadataTitleBox.stateChanged.connect(self.togglemetadataTitleBox)
|
||||||
MW.progressBarTick.connect(self.updateProgressbar)
|
MW.progressBarTick.connect(self.updateProgressbar)
|
||||||
MW.modeConvert.connect(self.modeConvert)
|
MW.modeConvert.connect(self.modeConvert)
|
||||||
MW.addMessage.connect(self.addMessage)
|
MW.addMessage.connect(self.addMessage)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
## Form generated from reading UI file 'KCC.ui'
|
## Form generated from reading UI file 'KCC.ui'
|
||||||
##
|
##
|
||||||
## Created by: Qt User Interface Compiler version 6.9.1
|
## Created by: Qt User Interface Compiler version 6.9.3
|
||||||
##
|
##
|
||||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
################################################################################
|
################################################################################
|
||||||
@@ -289,7 +289,16 @@ class Ui_mainWindow(object):
|
|||||||
self.authorEdit.setFocusPolicy(Qt.FocusPolicy.ClickFocus)
|
self.authorEdit.setFocusPolicy(Qt.FocusPolicy.ClickFocus)
|
||||||
self.authorEdit.setClearButtonEnabled(False)
|
self.authorEdit.setClearButtonEnabled(False)
|
||||||
|
|
||||||
self.gridLayout_2.addWidget(self.authorEdit, 0, 0, 1, 1)
|
self.gridLayout_2.addWidget(self.authorEdit, 0, 1, 1, 1)
|
||||||
|
|
||||||
|
self.titleEdit = QLineEdit(self.optionWidget)
|
||||||
|
self.titleEdit.setObjectName(u"titleEdit")
|
||||||
|
sizePolicy3.setHeightForWidth(self.titleEdit.sizePolicy().hasHeightForWidth())
|
||||||
|
self.titleEdit.setSizePolicy(sizePolicy3)
|
||||||
|
self.titleEdit.setFocusPolicy(Qt.FocusPolicy.ClickFocus)
|
||||||
|
self.titleEdit.setClearButtonEnabled(False)
|
||||||
|
|
||||||
|
self.gridLayout_2.addWidget(self.titleEdit, 0, 0, 1, 1)
|
||||||
|
|
||||||
self.rotateFirstBox = QCheckBox(self.optionWidget)
|
self.rotateFirstBox = QCheckBox(self.optionWidget)
|
||||||
self.rotateFirstBox.setObjectName(u"rotateFirstBox")
|
self.rotateFirstBox.setObjectName(u"rotateFirstBox")
|
||||||
@@ -319,6 +328,7 @@ class Ui_mainWindow(object):
|
|||||||
|
|
||||||
self.metadataTitleBox = QCheckBox(self.optionWidget)
|
self.metadataTitleBox = QCheckBox(self.optionWidget)
|
||||||
self.metadataTitleBox.setObjectName(u"metadataTitleBox")
|
self.metadataTitleBox.setObjectName(u"metadataTitleBox")
|
||||||
|
self.metadataTitleBox.setTristate(True)
|
||||||
|
|
||||||
self.gridLayout_2.addWidget(self.metadataTitleBox, 7, 0, 1, 1)
|
self.gridLayout_2.addWidget(self.metadataTitleBox, 7, 0, 1, 1)
|
||||||
|
|
||||||
@@ -562,6 +572,10 @@ class Ui_mainWindow(object):
|
|||||||
self.authorEdit.setToolTip(QCoreApplication.translate("mainWindow", u"Default Author is KCC", None))
|
self.authorEdit.setToolTip(QCoreApplication.translate("mainWindow", u"Default Author is KCC", None))
|
||||||
#endif // QT_CONFIG(tooltip)
|
#endif // QT_CONFIG(tooltip)
|
||||||
self.authorEdit.setPlaceholderText(QCoreApplication.translate("mainWindow", u"Default Author", None))
|
self.authorEdit.setPlaceholderText(QCoreApplication.translate("mainWindow", u"Default Author", None))
|
||||||
|
#if QT_CONFIG(tooltip)
|
||||||
|
self.titleEdit.setToolTip(QCoreApplication.translate("mainWindow", u"Default Title is based on filename, directory name or metadata", None))
|
||||||
|
#endif // QT_CONFIG(tooltip)
|
||||||
|
self.titleEdit.setPlaceholderText(QCoreApplication.translate("mainWindow", u"Default Title", None))
|
||||||
#if QT_CONFIG(tooltip)
|
#if QT_CONFIG(tooltip)
|
||||||
self.rotateFirstBox.setToolTip(QCoreApplication.translate("mainWindow", u"<html><head/><body><p>When the spread splitter option is partially checked,</p><p><span style=\" font-weight:600; text-decoration: underline;\">Unchecked - Rotate Last<br/></span>Put the rotated 2 page spread after the split spreads.</p><p><span style=\" font-weight:600; text-decoration: underline;\">Checked - Rotate First<br/></span>Put the rotated 2 page spread before the split spreads.</p></body></html>", None))
|
self.rotateFirstBox.setToolTip(QCoreApplication.translate("mainWindow", u"<html><head/><body><p>When the spread splitter option is partially checked,</p><p><span style=\" font-weight:600; text-decoration: underline;\">Unchecked - Rotate Last<br/></span>Put the rotated 2 page spread after the split spreads.</p><p><span style=\" font-weight:600; text-decoration: underline;\">Checked - Rotate First<br/></span>Put the rotated 2 page spread before the split spreads.</p></body></html>", None))
|
||||||
#endif // QT_CONFIG(tooltip)
|
#endif // QT_CONFIG(tooltip)
|
||||||
@@ -583,7 +597,7 @@ class Ui_mainWindow(object):
|
|||||||
#endif // QT_CONFIG(tooltip)
|
#endif // QT_CONFIG(tooltip)
|
||||||
self.outputSplit.setText(QCoreApplication.translate("mainWindow", u"Output split", None))
|
self.outputSplit.setText(QCoreApplication.translate("mainWindow", u"Output split", None))
|
||||||
#if QT_CONFIG(tooltip)
|
#if QT_CONFIG(tooltip)
|
||||||
self.metadataTitleBox.setToolTip(QCoreApplication.translate("mainWindow", u"<html><head/><body><p>Write Title from ComicInfo.xml or other embedded metadata.</p></body></html>", None))
|
self.metadataTitleBox.setToolTip(QCoreApplication.translate("mainWindow", u"<html><head/><body><p><span style=\" font-weight:600; text-decoration: underline;\">Unchecked - Don't use metadata Title<br/></span>Write default title.</p><p><span style=\" font-weight:600; text-decoration: underline;\">Indeterminate - Add metadata Title to the default schema<br/></span>Write default title with Title from ComicInfo.xml or other embedded metadata.</p><p><span style=\" font-weight:600; text-decoration: underline;\">Checked - Use metadata Title only<br/></span>Write Title from ComicInfo.xml or other embedded metadata.</p></body></html>", None))
|
||||||
#endif // QT_CONFIG(tooltip)
|
#endif // QT_CONFIG(tooltip)
|
||||||
self.metadataTitleBox.setText(QCoreApplication.translate("mainWindow", u"Metadata Title", None))
|
self.metadataTitleBox.setText(QCoreApplication.translate("mainWindow", u"Metadata Title", None))
|
||||||
#if QT_CONFIG(tooltip)
|
#if QT_CONFIG(tooltip)
|
||||||
|
|||||||
@@ -958,7 +958,7 @@ def getMetadata(path, originalpath):
|
|||||||
except Exception:
|
except Exception:
|
||||||
os.remove(xmlPath)
|
os.remove(xmlPath)
|
||||||
return
|
return
|
||||||
if options.metadatatitle:
|
if options.metadatatitle == 2:
|
||||||
options.title = xml.data['Title']
|
options.title = xml.data['Title']
|
||||||
elif defaultTitle:
|
elif defaultTitle:
|
||||||
if xml.data['Series']:
|
if xml.data['Series']:
|
||||||
@@ -967,6 +967,8 @@ def getMetadata(path, originalpath):
|
|||||||
titleSuffix += ' Vol. ' + xml.data['Volume'].zfill(2)
|
titleSuffix += ' Vol. ' + xml.data['Volume'].zfill(2)
|
||||||
if xml.data['Number']:
|
if xml.data['Number']:
|
||||||
titleSuffix += ' #' + xml.data['Number'].zfill(3)
|
titleSuffix += ' #' + xml.data['Number'].zfill(3)
|
||||||
|
if options.metadatatitle == 1 and xml.data['Title']:
|
||||||
|
titleSuffix += ': ' + xml.data['Title']
|
||||||
options.title += titleSuffix
|
options.title += titleSuffix
|
||||||
if defaultAuthor:
|
if defaultAuthor:
|
||||||
options.authors = []
|
options.authors = []
|
||||||
@@ -1290,8 +1292,9 @@ 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("--metadatatitle", action="store_true", dest="metadatatitle", default=False,
|
output_options.add_argument("--metadatatitle", type=int, dest="metadatatitle", default=0,
|
||||||
help="Write Title from ComicInfo.xml or other embedded metadata")
|
help="Write title using ComicInfo.xml or other embedded metadata. 1: Combine Title with default schema "
|
||||||
|
"2: Use Title only")
|
||||||
output_options.add_argument("-a", "--author", action="store", dest="author", default="defaultauthor",
|
output_options.add_argument("-a", "--author", action="store", dest="author", default="defaultauthor",
|
||||||
help="Author name [Default=KCC]")
|
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",
|
||||||
|
|||||||
Reference in New Issue
Block a user