Simplify regexes and use logger.warning

This commit is contained in:
Timmy Welch 2024-06-22 20:41:15 -07:00
parent e452fa153b
commit 385a46fc16
2 changed files with 3 additions and 3 deletions

View File

@ -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 != "":

View File

@ -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,