Skip to content

MetronInfo

XmlError

Bases: Exception

Class for an XML error.

MetronInfo()

Bases: BaseMetadataHandler

A class to manage comic metadata and its MetronInfo XML representation.

This class provides methods to convert metadata to and from XML format, validate information sources, and manage various attributes related to comic series, genres, and roles.

Initialize the MetronInfo instance.

Methods:

metadata_from_string(xml_string: str) -> Metadata

Convert an XML string to a Metadata object.

PARAMETER DESCRIPTION
xml_string

The XML string to be converted.

TYPE: str

RETURNS DESCRIPTION
Metadata

The resulting Metadata object.

string_from_metadata(metadata: Metadata, xml_bytes: bytes = b'') -> str

Convert a Metadata object to an XML string.

PARAMETER DESCRIPTION
metadata

The Metadata object to convert.

TYPE: Metadata

xml_bytes

Optional XML bytes to include.

TYPE: bytes DEFAULT: b''

RETURNS DESCRIPTION
str

The resulting XML string.

write_xml(filename: Path, metadata: Metadata, xml_bytes: bytes | None = None) -> None

Write a Metadata object to an XML file.

PARAMETER DESCRIPTION
filename

The path to the file where the XML will be written.

TYPE: Path

metadata

The Metadata object to write.

TYPE: Metadata

xml_bytes

Optional XML bytes to include.

TYPE: bytes | None DEFAULT: None

RAISES DESCRIPTION
XmlError

If XML validation fails.