imflib.assetmap

SMPTE 429-9-2007/2014: Asset Map

AssetMap and related classes Based on st-429-8-2007: https://ieeexplore.ieee.org/document/7290438

ASSETMAP.xml is the entry point into the IMF package. AssetMap provides the mapping between PKL UUIDs and file locations on a volume. The assetmap must exist and be identical on each volume it references. If multiple volumes are referenced, a VOLINDEX.xml file must be present with a unique index on each volume. The assetmap may contain mappings for more than one package.

class imflib.assetmap.Asset(id: ~uuid.UUID = <factory>, chunks: list['Chunk'] = <factory>, is_packing_list: ~typing.Optional[bool] = False, annotation_text: ~typing.Optional[~imflib.UserText] = None)

Bases: object

An Asset as defined in an IMF AssetMap

annotation_text: Optional[UserText] = None

Optional description of this asset

chunks: list['Chunk']

List of Chunk segments spanned by the file

property file_paths: list[str]

All file paths associated with this asset

classmethod from_xml(xml: Element, ns: Optional[dict] = None) Asset

Parse an Asset from an AssetList XML Element

id: UUID

Unique package identifier encoded as a urn:UUID [RFC 4122]

is_packing_list: Optional[bool] = False

Whether the asset is a Packing List (PKL)

property total_size: int

Total size of this asset in bytes

class imflib.assetmap.AssetMap(creator: ~imflib.UserText, issuer: ~imflib.UserText, id: ~uuid.UUID = <factory>, volume_count: int = 1, issue_date: ~datetime.datetime = <factory>, assets: list['Asset'] = <factory>, annotation_text: ~typing.Optional[~imflib.UserText] = None)

Bases: object

An Asset Map component of an IMF package

annotation_text: Optional[UserText] = None

Optional description of this asset map

assets: list['Asset']

The list of mapped Asset s

creator: UserText

The facility or system that created this asset map

classmethod from_file(path: str) AssetMap

Parse an existing AssetMap file

classmethod from_xml(xml: Element, ns: Optional[dict] = None) AssetMap

Parse the AssetMap from XML

get_asset(id: str) Asset

Get an Asset from the AssetMap based on the URN ID

id: UUID

Unique identifier for this asset map encoded as a urn:UUID [RFC 4122]

issue_date: datetime

Datetime this asset map was issued

issuer: UserText

The person or company that issued this asset map

property packing_lists: list['Asset']

A list of packing lists in this package

property total_size: int

Total size of the assets in this map

volume_count: int = 1

Total number of volumes referenced by this asset map

class imflib.assetmap.Chunk(file_path: str, volume_index: int = 1, offset: int = 0, size: Optional[int] = None)

Bases: object

A chunk of an Asset

file_path: str

Relative file path to the chunk

classmethod from_xml(xml: Element, ns: Optional[dict] = None) Chunk

Parse a chunk of an Asset from a ChunkList

offset: int = 0

Byte offset from the beginning of the assembled Asset

size: Optional[int] = None

Size of the chunk data in bytes

volume_index: int = 1

Index of the volume containing the chunk

class imflib.assetmap.VolumeIndex(index: int = 1)

Bases: object

A VolumeIndex file required only in multi-volume packages

classmethod from_file(path: str) VolumeIndex

Parse an existing VolumeIndex file

classmethod from_xml(xml: Element, ns: Optional[dict] = None) AssetMap

Parse the AssetMap from XML

index: int = 1

The index of this volume as referenced by the AssetMap