ISCC - Metadata Handling#
Metadata handling functions
extract_metadata(fp)
#
Extract metadata from file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fp
|
Filepath to media file. |
required |
Returns:
| Type | Description |
|---|---|
|
Metadata mapped to IsccMeta schema |
embed_metadata(fp, meta, outpath=None)
#
Embed metadata into a copy of the media file and return path to updated file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fp
|
str
|
Filepath to source media file |
required |
meta
|
Metadata to embed (IsccMeta or dict) |
required | |
outpath
|
Optional output filepath. If None, creates a temp file. |
None
|
Returns:
| Type | Description |
|---|---|
str|None
|
Filepath to the new media file with embedded metadata (None if no embedding supported) |
IsccMeta
#
Custom IsccMeta with text trimming and recursive parts support.
Serialization note:
Use .dict() instead of .model_dump() for serialization. The parent class
iscc_schema.base.BaseModel provides a .dict() method that wraps .model_dump()
with the correct defaults (exclude_none=True, exclude_unset=True,
by_alias=True). Calling .model_dump() directly uses different pydantic defaults
and will produce unexpected results (all fields including None values, field names
instead of aliases like type_ instead of @type).