diff --git a/comicapi/comet.py b/comicapi/comet.py index adc0d67..527045f 100644 --- a/comicapi/comet.py +++ b/comicapi/comet.py @@ -88,9 +88,9 @@ class CoMet: assign("readingDirection", "rtl") if md.year is not None: - date_str = str(md.year).zfill(4) + date_str = f"{md.year:04}" if md.month is not None: - date_str += "-" + str(md.month).zfill(2) + date_str += f"-{md.month:02}" assign("date", date_str) assign("coverImage", md.cover_image) diff --git a/comicapi/filenameparser.py b/comicapi/filenameparser.py index 0d37b76..c19c522 100644 --- a/comicapi/filenameparser.py +++ b/comicapi/filenameparser.py @@ -32,10 +32,13 @@ from text2digits import text2digits from comicapi import filenamelexer, issuestring +logger = logging.getLogger(__name__) + t2d = text2digits.Text2Digits(add_ordinal_ending=False) t2do = text2digits.Text2Digits(add_ordinal_ending=True) -logger = logging.getLogger(__name__) +placeholders_no_dashes = [re.compile(r"[-_]"), re.compile(r" +")] +placeholders_allow_dashes = [re.compile(r"[_]"), re.compile(r" +")] class FileNameParser: @@ -54,9 +57,9 @@ class FileNameParser: def fix_spaces(self, string: str, remove_dashes: bool = True) -> str: if remove_dashes: - placeholders = [r"[-_]", r" +"] + placeholders = placeholders_no_dashes else: - placeholders = [r"[_]", r" +"] + placeholders = placeholders_allow_dashes for ph in placeholders: string = re.sub(ph, self.repl, string) return string diff --git a/comictaggerlib/issueidentifier.py b/comictaggerlib/issueidentifier.py index 385cbf6..091e7a1 100644 --- a/comictaggerlib/issueidentifier.py +++ b/comictaggerlib/issueidentifier.py @@ -524,7 +524,7 @@ class IssueIdentifier: self.log_msg("") if len(self.match_list) == 0: - self.log_msg(":-(no matches!") + self.log_msg(":-( no matches!") self.search_result = self.result_no_matches return self.match_list diff --git a/comictaggerlib/pagelisteditor.py b/comictaggerlib/pagelisteditor.py index ce73595..bb2b39e 100644 --- a/comictaggerlib/pagelisteditor.py +++ b/comictaggerlib/pagelisteditor.py @@ -340,9 +340,9 @@ class PageListEditor(QtWidgets.QWidget): else: text += " (Error: " + page_dict["Type"] + ")" if "DoublePage" in page_dict: - text += " " + "\U00002461" + text += " ②" if "Bookmark" in page_dict: - text += " " + "\U0001F516" + text += " 🔖" return text def get_page_list(self) -> list[ImageMetadata]: diff --git a/comictaggerlib/taggerwindow.py b/comictaggerlib/taggerwindow.py index b7467dc..7658aeb 100644 --- a/comictaggerlib/taggerwindow.py +++ b/comictaggerlib/taggerwindow.py @@ -1712,7 +1712,7 @@ Have fun! ) if dlg.ignore_leading_digits_in_filename and md.series is not None: # remove all leading numbers - md.series = re.sub(r"([\d.]*)(.*)", "\\2", md.series) + md.series = re.sub(r"([\d.]*)(.*)", r"\2", md.series) # use the dialog specified search string if dlg.search_string: