minsci.xmu.tools.multimedia package

Submodules

minsci.xmu.tools.multimedia.cataloger module

Summarizes and generates metadata for the objects in an ecatalogue export

class minsci.xmu.tools.multimedia.cataloger.Cataloger(*args, **kwargs)[source]

Bases: minsci.xmu.xmu.XMu

Contains methods to generate metadata for a set of catalog objects

get(identifier, default=None, ignore_suffix=False)[source]

Retrieves catalog data matching a given identifier

get_one(identifier, default=None, ignore_suffix=False)[source]
static index_identifier(identifier)[source]

Indexes identification numbers from a catalog record

is_attached(mul_irn, cat_irn)[source]

Tests if multimedia is already linked in a catalog record

iterate(element)[source]

Indexes the objects in an EMu export file

pprint(pause=False)[source]

Pretty prints the catalog dictionary

class minsci.xmu.tools.multimedia.cataloger.Mediator(*args, **kwargs)[source]

Bases: minsci.xmu.xmu.XMu

get(key)[source]
iterate(element)[source]

Placeholder for iteration method

match_one(fn)[source]
minsci.xmu.tools.multimedia.cataloger.descriptify(summary)[source]

Converts a summary dict to a Description

minsci.xmu.tools.multimedia.cataloger.full(rec)[source]
minsci.xmu.tools.multimedia.cataloger.minimize(rec)[source]
minsci.xmu.tools.multimedia.cataloger.summarify(rec)[source]

minsci.xmu.tools.multimedia.embedder module

Tools to embed metadata in image files

class minsci.xmu.tools.multimedia.embedder.EmbedField(name, length, function)

Bases: tuple

function

Alias for field number 2

length

Alias for field number 1

name

Alias for field number 0

class minsci.xmu.tools.multimedia.embedder.Embedder(output_dir, overwrite=True)[source]

Bases: object

Tools to embed metadata in image files

change_output_directory(output_dir)[source]

Change the output directory

derive_metadata(rec, include_empty=False)[source]

Derives image metadata from source data

embed_metadata(rec, path, new_name=None)[source]

Embed metadata in the image file at the specified path

Parameters:
  • path (str) – path to the image file
  • rec (dict) – metadata about the image
  • verify (bool) – specifies whether to verify image after embedding
Returns:

Boolean indicating whether embed succeeded

get_caption(rec)[source]

Placeholder function returning the caption

Placeholder function returning copyright info

get_creator(rec)[source]

Placeholder function returning the creator

get_credit_line(rec)[source]

Placeholder function returning the credit line

get_date_created(rec)[source]

Placeholder function returning the date created

get_datetime_created(rec)[source]

Placeholder function returning the full date and time created

get_headline(rec)[source]

Placeholder function returning the headline

get_inventory_numbers(rec)[source]

Placeholder function returning the headline

get_job_id(rec)[source]

Placeholder function returning the job ID

get_keywords(rec)[source]

Placeholder function returning keywords

get_mtime(path, mask='%Y:%m:%d %H:%M:%S%z')[source]

Get modification time for file at path

get_object_name(rec)[source]

Placeholder function returning the object name

get_source(rec)[source]

Placeholder function returning the media source

get_special_instructions(rec)[source]

Placeholder function returning special instructions

get_subjects(rec)[source]

Placeholder function returning subject codes

get_time_created(rec)[source]

Placeholder function returning the time created

get_transmission_reference(rec)[source]

Placeholder function returning the transmission reference

minsci.xmu.tools.multimedia.hasher module

Contains methods to hash a file or image data from a file

minsci.xmu.tools.multimedia.hasher.hash_file(path)[source]

Returns MD5 hash of a file

Parameters:path (str) – path to image
Returns:Hash as string
minsci.xmu.tools.multimedia.hasher.hash_image_data(path, output_dir='images')[source]

Returns MD5 hash of the image data in a file

Parameters:path (str) – path to image file
Returns:Hash of image data as string
minsci.xmu.tools.multimedia.hasher.hasher(filestream, size=8192)[source]

Generate MD5 hash for a file

Parameters:
  • filestream (file) – stream of file to hash
  • size (int) – size of block. Should be multiple of 128.
Returns:

Tuple of (filename, hash)

Module contents

Provides tools to create and embed metadata in images