madam.exif module

class madam.exif.ExifMetadataProcessor(config: Mapping[str, Any] | None = None)[source]

Bases: MetadataProcessor

Represents a metadata processor for Exif metadata.

__init__(config: Mapping[str, Any] | None = None) None[source]

Initializes a new ExifMetadataProcessor.

Parameters:

config – Mapping with settings

combine(file: IO, metadata: Mapping[str, Mapping]) IO[source]

Returns a byte stream whose contents represent the specified file where the specified metadata was added.

Parameters:
  • metadata (Mapping) – Mapping of the metadata format to the metadata dict

  • file (IO) – Container file

Returns:

file-like object with combined content

Return type:

IO

property formats: Iterable[str]

The metadata formats which are supported.

Returns:

supported metadata formats

Return type:

set[str]

read(file: IO) Mapping[str, Mapping][source]

Reads the file and returns the metadata.

The metadata that is returned is grouped by type. The keys are specified by format.

Parameters:

file (IO) – File-like object to be read

Returns:

Metadata contained in the file

Return type:

Mapping

Raises:

UnsupportedFormatError – if the data is corrupt or its format is not supported

strip(file: IO) IO[source]

Removes all metadata of the supported type from the specified file.

Parameters:

file (IO) – file-like that should get stripped of the metadata

Returns:

file-like object without metadata

Return type:

IO