From dda0cb521acbf647ad30fd7351fc042b5a7d7656 Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Sun, 21 Jan 2024 15:00:28 -0800 Subject: [PATCH] Add more credit synonyms --- comicapi/genericmetadata.py | 15 +++++++------- comicapi/metadata/comet.py | 36 +++++++++++++--------------------- comicapi/metadata/comicrack.py | 36 +++++++++++++--------------------- 3 files changed, 36 insertions(+), 51 deletions(-) diff --git a/comicapi/genericmetadata.py b/comicapi/genericmetadata.py index faa3d00..cae6e65 100644 --- a/comicapi/genericmetadata.py +++ b/comicapi/genericmetadata.py @@ -94,13 +94,14 @@ class TagOrigin(NamedTuple): @dataclasses.dataclass class GenericMetadata: - writer_synonyms = ["writer", "plotter", "scripter"] - penciller_synonyms = ["artist", "penciller", "penciler", "breakdowns"] - inker_synonyms = ["inker", "artist", "finishes"] - colorist_synonyms = ["colorist", "colourist", "colorer", "colourer"] - letterer_synonyms = ["letterer"] - cover_synonyms = ["cover", "covers", "coverartist", "cover artist"] - editor_synonyms = ["editor"] + writer_synonyms = ("writer", "plotter", "scripter", "script") + penciller_synonyms = ("artist", "penciller", "penciler", "breakdowns", "pencils", "painting") + inker_synonyms = ("inker", "artist", "finishes", "inks", "painting") + colorist_synonyms = ("colorist", "colourist", "colorer", "colourer", "colors", "painting") + letterer_synonyms = ("letterer", "letters") + cover_synonyms = ("cover", "covers", "coverartist", "cover artist") + editor_synonyms = ("editor", "edits", "editing") + _translator_synonyms = ("translator", "translation") is_empty: bool = True tag_origin: TagOrigin | None = None diff --git a/comicapi/metadata/comet.py b/comicapi/metadata/comet.py index d8b67e7..f165741 100644 --- a/comicapi/metadata/comet.py +++ b/comicapi/metadata/comet.py @@ -30,14 +30,6 @@ logger = logging.getLogger(__name__) class CoMet(Metadata): - _writer_synonyms = ("writer", "plotter", "scripter") - _penciller_synonyms = ("artist", "penciller", "penciler", "breakdowns") - _inker_synonyms = ("inker", "artist", "finishes") - _colorist_synonyms = ("colorist", "colourist", "colorer", "colourer") - _letterer_synonyms = ("letterer",) - _cover_synonyms = ("cover", "covers", "coverartist", "cover artist") - _editor_synonyms = ("editor",) - enabled = True short_name = "comet" @@ -136,13 +128,13 @@ class CoMet(Metadata): @classmethod def _get_parseable_credits(cls) -> list[str]: parsable_credits: list[str] = [] - parsable_credits.extend(cls._writer_synonyms) - parsable_credits.extend(cls._penciller_synonyms) - parsable_credits.extend(cls._inker_synonyms) - parsable_credits.extend(cls._colorist_synonyms) - parsable_credits.extend(cls._letterer_synonyms) - parsable_credits.extend(cls._cover_synonyms) - parsable_credits.extend(cls._editor_synonyms) + parsable_credits.extend(GenericMetadata.writer_synonyms) + parsable_credits.extend(GenericMetadata.penciller_synonyms) + parsable_credits.extend(GenericMetadata.inker_synonyms) + parsable_credits.extend(GenericMetadata.colorist_synonyms) + parsable_credits.extend(GenericMetadata.letterer_synonyms) + parsable_credits.extend(GenericMetadata.cover_synonyms) + parsable_credits.extend(GenericMetadata.editor_synonyms) return parsable_credits def _metadata_from_bytes(self, string: bytes, archive: Archiver) -> GenericMetadata: @@ -206,25 +198,25 @@ class CoMet(Metadata): # loop thru credits, and build a list for each role that CoMet supports for credit in metadata.credits: - if credit["role"].casefold() in set(self._writer_synonyms): + if credit["role"].casefold() in set(GenericMetadata.writer_synonyms): ET.SubElement(root, "writer").text = str(credit["person"]) - if credit["role"].casefold() in set(self._penciller_synonyms): + if credit["role"].casefold() in set(GenericMetadata.penciller_synonyms): ET.SubElement(root, "penciller").text = str(credit["person"]) - if credit["role"].casefold() in set(self._inker_synonyms): + if credit["role"].casefold() in set(GenericMetadata.inker_synonyms): ET.SubElement(root, "inker").text = str(credit["person"]) - if credit["role"].casefold() in set(self._colorist_synonyms): + if credit["role"].casefold() in set(GenericMetadata.colorist_synonyms): ET.SubElement(root, "colorist").text = str(credit["person"]) - if credit["role"].casefold() in set(self._letterer_synonyms): + if credit["role"].casefold() in set(GenericMetadata.letterer_synonyms): ET.SubElement(root, "letterer").text = str(credit["person"]) - if credit["role"].casefold() in set(self._cover_synonyms): + if credit["role"].casefold() in set(GenericMetadata.cover_synonyms): ET.SubElement(root, "coverDesigner").text = str(credit["person"]) - if credit["role"].casefold() in set(self._editor_synonyms): + if credit["role"].casefold() in set(GenericMetadata.editor_synonyms): ET.SubElement(root, "editor").text = str(credit["person"]) ET.indent(root) diff --git a/comicapi/metadata/comicrack.py b/comicapi/metadata/comicrack.py index 7fea529..e3d90fd 100644 --- a/comicapi/metadata/comicrack.py +++ b/comicapi/metadata/comicrack.py @@ -28,14 +28,6 @@ logger = logging.getLogger(__name__) class ComicRack(Metadata): - _writer_synonyms = ("writer", "plotter", "scripter") - _penciller_synonyms = ("artist", "penciller", "penciler", "breakdowns") - _inker_synonyms = ("inker", "artist", "finishes") - _colorist_synonyms = ("colorist", "colourist", "colorer", "colourer") - _letterer_synonyms = ("letterer",) - _cover_synonyms = ("cover", "covers", "coverartist", "cover artist") - _editor_synonyms = ("editor",) - enabled = True short_name = "cr" @@ -132,13 +124,13 @@ class ComicRack(Metadata): @classmethod def _get_parseable_credits(cls) -> list[str]: parsable_credits: list[str] = [] - parsable_credits.extend(cls._writer_synonyms) - parsable_credits.extend(cls._penciller_synonyms) - parsable_credits.extend(cls._inker_synonyms) - parsable_credits.extend(cls._colorist_synonyms) - parsable_credits.extend(cls._letterer_synonyms) - parsable_credits.extend(cls._cover_synonyms) - parsable_credits.extend(cls._editor_synonyms) + parsable_credits.extend(GenericMetadata.writer_synonyms) + parsable_credits.extend(GenericMetadata.penciller_synonyms) + parsable_credits.extend(GenericMetadata.inker_synonyms) + parsable_credits.extend(GenericMetadata.colorist_synonyms) + parsable_credits.extend(GenericMetadata.letterer_synonyms) + parsable_credits.extend(GenericMetadata.cover_synonyms) + parsable_credits.extend(GenericMetadata.editor_synonyms) return parsable_credits def _metadata_from_bytes(self, string: bytes) -> GenericMetadata: @@ -194,25 +186,25 @@ class ComicRack(Metadata): # first, loop thru credits, and build a list for each role that CIX # supports for credit in metadata.credits: - if credit["role"].casefold() in set(self._writer_synonyms): + if credit["role"].casefold() in set(GenericMetadata.writer_synonyms): credit_writer_list.append(credit["person"].replace(",", "")) - if credit["role"].casefold() in set(self._penciller_synonyms): + if credit["role"].casefold() in set(GenericMetadata.penciller_synonyms): credit_penciller_list.append(credit["person"].replace(",", "")) - if credit["role"].casefold() in set(self._inker_synonyms): + if credit["role"].casefold() in set(GenericMetadata.inker_synonyms): credit_inker_list.append(credit["person"].replace(",", "")) - if credit["role"].casefold() in set(self._colorist_synonyms): + if credit["role"].casefold() in set(GenericMetadata.colorist_synonyms): credit_colorist_list.append(credit["person"].replace(",", "")) - if credit["role"].casefold() in set(self._letterer_synonyms): + if credit["role"].casefold() in set(GenericMetadata.letterer_synonyms): credit_letterer_list.append(credit["person"].replace(",", "")) - if credit["role"].casefold() in set(self._cover_synonyms): + if credit["role"].casefold() in set(GenericMetadata.cover_synonyms): credit_cover_list.append(credit["person"].replace(",", "")) - if credit["role"].casefold() in set(self._editor_synonyms): + if credit["role"].casefold() in set(GenericMetadata.editor_synonyms): credit_editor_list.append(credit["person"].replace(",", "")) assign("Series", md.series)