comicbox.formats.base.transforms.identifiers

source module comicbox.formats.base.transforms.identifiers

Identifier Fields.

Functions

source merge_url_and_explicit_identifiers(url_identifiers: dict, *explicit_identifier_dicts: dict)dict

Merge URL-derived and explicit-id identifiers with per-field precedence.

A web URL’s path is not a reliable canonical id — for sources like Metron it’s a slug, not the numeric issue id carried by an <ID>/GTIN tag — so an explicit identifier’s key must win over a URL-derived one. Conversely a real URL must win over the url that create_identifier synthesizes from a bare id. Naively additive-merging the two (URL last) clobbers the authoritative numeric key with the slug, which breaks downstream id lookups; this restores the right precedence one field at a time.

source create_identifier_primary_source(id_source: IdSources)dict

Create identifier primary source.

source identifiers_to_cb(native_identifiers: set[str] | None, naked_id_source: Any)dict

Parse identifier struct from a string or sequence.

source identifiers_transform_to_cb(identifiers_tag: str, naked_id_source: IdSources)MetaSpec

Transform identifier tags to comicbox identifiers.

source identifiers_transform_from_cb(identifiers_tag: str)MetaSpec

Transform comicbox identifiers identifier tag.

source url_to_cb(native_url: str | dict)tuple[str, dict]

Parse one url into identifier.

source urls_to_cb(urls: Any)dict

Parse url tags into identifiers.

source url_from_cb(id_source_str: str, comicbox_identifier: dict)str

Unparse one identifier into one url tag.

source urls_transform_from_cb(urls_tag: str)MetaSpec

Transform comicbox identifiers to urls tags.