Merge branch 'Renaming'
This commit is contained in:
commit
76b524c767
@ -518,7 +518,14 @@ def process_file_cli(filename, opts, settings, match_results):
|
||||
renamer.setSmartCleanup(settings.rename_use_smart_string_cleanup)
|
||||
renamer.move = settings.rename_move_dir
|
||||
|
||||
new_name = renamer.determineName(filename, ext=new_ext)
|
||||
try:
|
||||
new_name = renamer.determineName(filename, ext=new_ext)
|
||||
except Exception as e:
|
||||
print(msg_hdr + "Invalid format string!\nYour rename template is invalid!\n\n"
|
||||
"{}\n\nPlease consult the template help in the settings "
|
||||
"and the documentation on the format at "
|
||||
"https://docs.python.org/3/library/string.html#format-string-syntax", file=sys.stderr)
|
||||
return
|
||||
|
||||
folder = os.path.dirname(os.path.abspath(filename))
|
||||
if settings.rename_move_dir and len(settings.rename_dir.strip()) > 3:
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
import os
|
||||
import re
|
||||
import datetime
|
||||
import sys
|
||||
import string
|
||||
|
||||
|
@ -77,7 +77,19 @@ class RenameWindow(QtWidgets.QDialog):
|
||||
md = ca.metadataFromFilename(self.settings.parse_scan_info)
|
||||
self.renamer.setMetadata(md)
|
||||
self.renamer.move = self.settings.rename_move_dir
|
||||
new_name = self.renamer.determineName(ca.path, ext=new_ext)
|
||||
|
||||
try:
|
||||
new_name = self.renamer.determineName(ca.path, ext=new_ext)
|
||||
except Exception as e:
|
||||
QtWidgets.QMessageBox.critical(self, 'Invalid format string!',
|
||||
'Your rename template is invalid!'
|
||||
'<br/><br/>{}<br/><br/>'
|
||||
'Please consult the template help in the '
|
||||
'settings and the documentation on the format at '
|
||||
'<a href=\'https://docs.python.org/3/library/string.html#format-string-syntax\'>'
|
||||
'https://docs.python.org/3/library/string.html#format-string-syntax</a>'.format(e))
|
||||
return
|
||||
|
||||
|
||||
row = self.twList.rowCount()
|
||||
self.twList.insertRow(row)
|
||||
|
@ -24,6 +24,8 @@ from .settings import ComicTaggerSettings
|
||||
from .comicvinecacher import ComicVineCacher
|
||||
from .comicvinetalker import ComicVineTalker
|
||||
from .imagefetcher import ImageFetcher
|
||||
from .filerenamer import FileRenamer
|
||||
from .genericmetadata import GenericMetadata
|
||||
from . import utils
|
||||
|
||||
|
||||
@ -154,6 +156,65 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
self.btnTestKey.clicked.connect(self.testAPIKey)
|
||||
self.btnTemplateHelp.clicked.connect(self.showTemplateHelp)
|
||||
|
||||
def configRenamer(self):
|
||||
md = GenericMetadata()
|
||||
md.isEmpty = False
|
||||
md.tagOrigin = "testing"
|
||||
|
||||
md.series = "series name"
|
||||
md.issue = "1"
|
||||
md.title = "issue title"
|
||||
md.publisher = "lordwelch"
|
||||
md.month = 4
|
||||
md.year = 1998
|
||||
md.day = 4
|
||||
md.issueCount = 1
|
||||
md.volume = 256
|
||||
md.genre = "test"
|
||||
md.language = "en" # 2 letter iso code
|
||||
md.comments = "This is definitly not something you want to read." # use same way as Summary in CIX
|
||||
|
||||
md.volumeCount = 4096
|
||||
md.criticalRating = "Worst Comic Ever"
|
||||
md.country = "US"
|
||||
|
||||
md.alternateSeries = "None"
|
||||
md.alternateNumber = 4.4
|
||||
md.alternateCount = 4444
|
||||
md.imprint = 'Welch Publishing'
|
||||
md.notes = "This doesn't actually exist"
|
||||
md.webLink = "https://example.com/series name/1"
|
||||
md.format = "Box Set"
|
||||
md.manga = "Yes"
|
||||
md.blackAndWhite = False
|
||||
md.pageCount = 4
|
||||
md.maturityRating = "Everyone"
|
||||
|
||||
md.storyArc = "None of your buisness"
|
||||
md.seriesGroup = "Advertures of buisness"
|
||||
md.scanInfo = "(lordwelch)"
|
||||
|
||||
md.characters = "lordwelch, Welch"
|
||||
md.teams = "None"
|
||||
md.locations = "Earth, 444 B.C."
|
||||
|
||||
md.credits = [dict({'role': 'Everything', 'person': 'lordwelch', 'primary': True})]
|
||||
md.tags = ["testing", "not testing", "fake"]
|
||||
md.pages = [dict({'Image': '0', 'Type': 'Front Cover'}), dict({'Image': '1', 'Type': 'Story'})]
|
||||
|
||||
# Some CoMet-only items
|
||||
md.price = 0.00
|
||||
md.isVersionOf = "SERIES #1"
|
||||
md.rights = "None"
|
||||
md.identifier = "LW4444-Comic"
|
||||
md.lastMark = "0"
|
||||
md.coverImage = "https://example.com/series name/1/cover"
|
||||
|
||||
self.renamer = FileRenamer(md)
|
||||
self.renamer.setTemplate(str(self.leRenameTemplate.text()))
|
||||
self.renamer.setIssueZeroPadding(self.settings.rename_issue_number_padding)
|
||||
self.renamer.setSmartCleanup(self.settings.rename_use_smart_string_cleanup)
|
||||
|
||||
def settingsToForm(self):
|
||||
|
||||
# Copy values from settings to form
|
||||
@ -212,6 +273,21 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
|
||||
def accept(self):
|
||||
|
||||
self.configRenamer()
|
||||
|
||||
|
||||
try:
|
||||
new_name = self.renamer.determineName('test.cbz')
|
||||
except Exception as e:
|
||||
QtWidgets.QMessageBox.critical(self, 'Invalid format string!',
|
||||
'Your rename template is invalid!'
|
||||
'<br/><br/>{}<br/><br/>'
|
||||
'Please consult the template help in the '
|
||||
'settings and the documentation on the format at '
|
||||
'<a href=\'https://docs.python.org/3/library/string.html#format-string-syntax\'>'
|
||||
'https://docs.python.org/3/library/string.html#format-string-syntax</a>'.format(e))
|
||||
return
|
||||
|
||||
# Copy values from form to settings and save
|
||||
self.settings.rar_exe_path = str(self.leRarExePath.text())
|
||||
|
||||
@ -333,7 +409,8 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
|
||||
def showTemplateHelp(self):
|
||||
TemplateHelpWin = TemplateHelpWindow(self)
|
||||
TemplateHelpWin.exec_()
|
||||
TemplateHelpWin.setModal(False)
|
||||
TemplateHelpWin.show()
|
||||
|
||||
class TemplateHelpWindow(QtWidgets.QDialog):
|
||||
|
||||
|
@ -55,7 +55,7 @@
|
||||
{criticalRating}	(string)
|
||||
{country}	(string)
|
||||
{alternateSeries}	(string)
|
||||
{alternateinteger}	(string)
|
||||
{alternateNumber}	(string)
|
||||
{alternateCount}	(integer)
|
||||
{imprint}		(string)
|
||||
{notes}		(string)
|
||||
@ -76,8 +76,8 @@
|
||||
{pages}		(list of dict({'Image': 'str(int)', 'Type': 'str'}))
|
||||
|
||||
CoMet-only items:
|
||||
{price}		(integer)
|
||||
{isVersionOf}	(boolean)
|
||||
{price}		(float)
|
||||
{isVersionOf}	(string)
|
||||
{rights}		(string)
|
||||
{identifier}	(string)
|
||||
{lastMark}	(string)
|
||||
|
@ -520,28 +520,27 @@ Accepts the following variables:
|
||||
{issue} (string)
|
||||
{title} (string)
|
||||
{publisher} (string)
|
||||
{month} (number)
|
||||
{year} (number)
|
||||
{day} (number)
|
||||
{date} (Date)
|
||||
{issueCount} (number)
|
||||
{volume} (number)
|
||||
{month} (integer)
|
||||
{year} (integer)
|
||||
{day} (integer)
|
||||
{issueCount} (integer)
|
||||
{volume} (integer)
|
||||
{genre} (string)
|
||||
{language} (string)
|
||||
{comments} (string)
|
||||
{volumeCount} (number)
|
||||
{volumeCount} (integer)
|
||||
{criticalRating} (string)
|
||||
{country} (string)
|
||||
{alternateSeries} (string)
|
||||
{alternateNumber} (string)
|
||||
{alternateCount} (number)
|
||||
{alternateCount} (integer)
|
||||
{imprint} (string)
|
||||
{notes} (string)
|
||||
{webLink} (string)
|
||||
{format} (string)
|
||||
{manga} (string)
|
||||
{blackAndWhite} (boolean)
|
||||
{pageCount} (number)
|
||||
{pageCount} (integer)
|
||||
{maturityRating} (string)
|
||||
{storyArc} (string)
|
||||
{seriesGroup} (string)
|
||||
@ -554,8 +553,8 @@ Accepts the following variables:
|
||||
{pages} (list of dict({'Image': 'str(int)', 'Type': 'str'}))
|
||||
|
||||
CoMet-only items:
|
||||
{price} (number)
|
||||
{isVersionOf} (boolean)
|
||||
{price} (float)
|
||||
{isVersionOf} (string)
|
||||
{rights} (string)
|
||||
{identifier} (string)
|
||||
{lastMark} (string)
|
||||
|
Loading…
Reference in New Issue
Block a user