Skip to content

comicbox.identifiers.other

Non urn identifier substring parsers.

parse_identifier_other_str(full_identifier)

Parse an identifier string with optional prefix.

The string has to be an identifier and nothing else. Matching a substring turned every tag and genre that merely contained something identifier shaped into an id: “marvel-comics” was a marvel id, and a year range like “2019-2021” was a comicvine one.

Source code in comicbox/identifiers/other.py
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
def parse_identifier_other_str(
    full_identifier: str,
) -> tuple[IdSources | None, str, str]:
    """
    Parse an identifier string with optional prefix.

    The string has to be an identifier and nothing else. Matching a
    substring turned every tag and genre that merely contained something
    identifier shaped into an id: "marvel-comics" was a marvel id, and a
    year range like "2019-2021" was a comicvine one.
    """
    full_identifier = full_identifier.strip()
    id_source, id_type, id_key = _parse_identifier_str_comicvine(full_identifier)
    if not id_key:
        id_source, id_type, id_key = _parse_identifier_other_str(full_identifier)
    if not id_key:
        id_key = full_identifier
    return id_source, id_type, id_key