parse number issues earlier. pop alpha_month. strip commas from titles and series

This commit is contained in:
AJ Slater 2024-02-20 17:35:03 -08:00
parent 57ecf4f354
commit a3bc43b2d6

View File

@ -68,6 +68,7 @@ class ComicFilenameParser:
value = value.strip() value = value.strip()
value = value.strip("()").strip() value = value.strip("()").strip()
value = value.strip("-").strip() value = value.strip("-").strip()
value = value.strip(",").strip()
value = value.strip("'").strip('"').strip() value = value.strip("'").strip('"').strip()
return value return value
@ -99,7 +100,7 @@ class ComicFilenameParser:
def _alpha_month_to_numeric(self): def _alpha_month_to_numeric(self):
"""Translate alpha_month to numeric month.""" """Translate alpha_month to numeric month."""
if alpha_month := self.metadata.get("alpha_month", ""): if alpha_month := self.metadata.pop("alpha_month", ""):
alpha_month = alpha_month.capitalize() # type: ignore alpha_month = alpha_month.capitalize() # type: ignore
for index, abbr in enumerate(month_abbr): for index, abbr in enumerate(month_abbr):
if abbr and alpha_month.startswith(abbr): if abbr and alpha_month.startswith(abbr):
@ -197,6 +198,7 @@ class ComicFilenameParser:
self._log_progress("CLEANED") self._log_progress("CLEANED")
# Parse paren tokens # Parse paren tokens
self._parse_items(ISSUE_NUMBER_RE)
self._parse_items(ISSUE_COUNT_RE) self._parse_items(ISSUE_COUNT_RE)
self._parse_dates() self._parse_dates()
self._parse_items( self._parse_items(
@ -211,7 +213,6 @@ class ComicFilenameParser:
# Parse regular tokens # Parse regular tokens
self._parse_items(VOLUME_RE) self._parse_items(VOLUME_RE)
self._parse_items(ISSUE_NUMBER_RE)
self._log_progress("AFTER REGULAR TOKENS") self._log_progress("AFTER REGULAR TOKENS")
# Pickup issue if it's a standalone token # Pickup issue if it's a standalone token