Simplify regexes and use logger.warning
This commit is contained in:
parent
e452fa153b
commit
385a46fc16
@ -74,7 +74,7 @@ class FileNameParser:
|
||||
# replace any name separators with spaces
|
||||
tmpstr = self.fix_spaces(filename)
|
||||
|
||||
match = re.search(r"(?:\s\(?of\s)(\d+)(?: |\))", tmpstr, re.IGNORECASE)
|
||||
match = re.search(r"\s\(?of\s(\d+)[ )]", tmpstr, re.IGNORECASE)
|
||||
if match:
|
||||
count = match.group(1)
|
||||
|
||||
@ -264,7 +264,7 @@ class FileNameParser:
|
||||
|
||||
remainder = self.fix_spaces(remainder, remove_dashes=False)
|
||||
if volume != "":
|
||||
remainder = re.sub(r"(?i)(.+)((?:v(?:|ol|olume))\.?\s?)" + volume, "", remainder, count=1)
|
||||
remainder = re.sub(r"(?i)(.+)(v(?:|ol|olume)\.?\s?)" + volume, "", remainder, count=1)
|
||||
if year != "":
|
||||
remainder = remainder.replace(year, "", 1)
|
||||
if count != "":
|
||||
|
@ -316,7 +316,7 @@ def get_config_from_tab(tab: TalkerTab, definitions: settngs.Group) -> dict[str,
|
||||
and guessed_type not in (None, "Any")
|
||||
and (isinstance(guessed_type, type) and not isinstance(value, guessed_type))
|
||||
):
|
||||
logger.warn(
|
||||
logger.warning(
|
||||
"Guessed type is wrong on for '%s': expected: %s got: %s",
|
||||
setting_name,
|
||||
guessed_type,
|
||||
|
Loading…
Reference in New Issue
Block a user