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:
|
| 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:
|
xml_bytes
|
Optional XML bytes to include.
TYPE:
|
| 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:
|
metadata
|
The Metadata object to write.
TYPE:
|
xml_bytes
|
Optional XML bytes to include.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
XmlError
|
If XML validation fails. |