Character

class amqcsl.workflows.character.ArtistName(name, original_name=None, disambiguation=None)
name: str
original_name: str | None
disambiguation: str | None
classmethod from_key(artist_key)
Return type:

Self

match(artist)
Return type:

bool

type amqcsl.workflows.character.ArtistKey = ArtistName | tuple[str, str | None] | str
type amqcsl.workflows.character.CharacterDict = Mapping[str, str]
type amqcsl.workflows.character.ArtistDict = Mapping[ArtistKey, str]
type amqcsl.workflows.character.ArtistToMeta = Mapping[CSLArtistSample, Sequence[ExtraMetadata]]
amqcsl.workflows.character.compact_make_artist_to_meta(client, artists, search_phrases=(), sep=', ')
Overloads:
  • client (DBClient), artists (ArtistDict), search_phrases (Sequence[str]), sep (str) → ArtistToMeta

  • client (AsyncDBClient), artists (ArtistDict), search_phrases (Sequence[str]), sep (str) → Awaitable[ArtistToMeta]

Make the artist to metadata dict with a compact artist dict

Parameters:
  • client (DBClient | AsyncDBClient) – (Async)DBClient

  • artists (TypeAliasType) – ArtistDict, values should be character names separated by sep

  • search_phrases (Sequence[str]) – List of search phrases to be passed to iter_artists

  • sep (str) – Separator for artist values

Returns:

ArtistToMeta

amqcsl.workflows.character.make_artist_to_meta(client, characters, artists, search_phrases=(), sep=' ')
Overloads:
  • client (DBClient), characters (CharacterDict), artists (ArtistDict), search_phrases (Sequence[str]), sep (str) → ArtistToMeta

  • client (AsyncDBClient), characters (CharacterDict), artists (ArtistDict), search_phrases (Sequence[str]), sep (str) → Awaitable[ArtistToMeta]

Make the artist to metadata dict

Parameters:
  • client (DBClient | AsyncDBClient) – (Async)DBClient

  • characters (TypeAliasType) – CharacterDict

  • artists (TypeAliasType) – ArtistDict, values should be keys of characters separated by sep

  • search_phrases (Sequence[str]) – List of search phrases to be passed to iter_artists

  • sep (str) – Separator for artist values

Returns:

ArtistToMeta

amqcsl.workflows.character.queue_character_metadata(client, track, artist_to_meta, meta=None, unknown_artist_handler=<function prompt_artist_handler>)

Queue character metadata changes This function will clear any existing character metadata (including any that are song metadata) and add all metadata according to artist_to_meta

Parameters:
  • client (DBClient | AsyncDBClient) – DBClient

  • track (CSLTrack) – Track to be edited

  • artist_to_meta (TypeAliasType) – {artist: [metas]}

  • meta (CSLMetadata | None) – Existing metadata of the track

Return type:

None

amqcsl.workflows.character.prompt(*objs, msg='Accept?', pretty=True, continue_on_empty=False, default=True, **kwargs)

Prompt the user for a Yes or No answer, or to quit the script

Parameters:
  • objs (Any) – Objects to print

  • msg (str) – Message to prompt user with, defaults to ‘Accept?’

  • pretty (bool) – Whether to pretty print with rich.pretty.pprint

  • continue_on_empty (bool) – Whether to exit input loop on empty input

  • default (bool) – Default to pass if continue_on_empty is True and empty is passed

  • kwargs (Any) – Kwargs to pass to the print function

Return type:

bool

Returns:

User’s choice as a boolean

Raises:

QuitError – If the user chooses to quit