Add more credit synonyms

This commit is contained in:
Timmy Welch 2024-01-21 15:00:28 -08:00
parent bb1a83b4ba
commit dda0cb521a
3 changed files with 36 additions and 51 deletions

View File

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

View File

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

View File

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