Skip to content

Commit

Permalink
Use credit synonyms from GenericMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
lordwelch committed Feb 19, 2024
1 parent 1dba03a commit c97e8f4
Showing 1 changed file with 16 additions and 25 deletions.
41 changes: 16 additions & 25 deletions comicinfoxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@


class ComicInfoXml(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',)
_translator_synonyms = ('translator',)

enabled = True

short_name = 'cix'
Expand Down Expand Up @@ -137,14 +128,14 @@ def name(self) -> str:
@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(cls._translator_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)
parsable_credits.extend(GenericMetadata.translator_synonyms)
return parsable_credits

def _metadata_from_bytes(self, string: bytes) -> GenericMetadata:
Expand Down Expand Up @@ -201,28 +192,28 @@ def assign(cr_entry: str, md_entry: Any) -> None:
# first, loop thru credits, and build a list for each role that CIX
# supports
for credit in metadata.credits:
if credit['role'].casefold() in self._writer_synonyms:
if credit['role'].casefold() in GenericMetadata.writer_synonyms:
credit_writer_list.append(credit['person'].replace(',', ''))

if credit['role'].casefold() in self._penciller_synonyms:
if credit['role'].casefold() in GenericMetadata.penciller_synonyms:
credit_penciller_list.append(credit['person'].replace(',', ''))

if credit['role'].casefold() in self._inker_synonyms:
if credit['role'].casefold() in GenericMetadata.inker_synonyms:
credit_inker_list.append(credit['person'].replace(',', ''))

if credit['role'].casefold() in self._colorist_synonyms:
if credit['role'].casefold() in GenericMetadata.colorist_synonyms:
credit_colorist_list.append(credit['person'].replace(',', ''))

if credit['role'].casefold() in self._letterer_synonyms:
if credit['role'].casefold() in GenericMetadata.letterer_synonyms:
credit_letterer_list.append(credit['person'].replace(',', ''))

if credit['role'].casefold() in self._cover_synonyms:
if credit['role'].casefold() in GenericMetadata.cover_synonyms:
credit_cover_list.append(credit['person'].replace(',', ''))

if credit['role'].casefold() in self._editor_synonyms:
if credit['role'].casefold() in GenericMetadata.editor_synonyms:
credit_editor_list.append(credit['person'].replace(',', ''))

if credit['role'].casefold() in self._translator_synonyms:
if credit['role'].casefold() in GenericMetadata.translator_synonyms:
credit_translator_list.append(credit['person'].replace(',', ''))

assign('Series', md.series)
Expand Down

0 comments on commit c97e8f4

Please sign in to comment.