exiftool.experimental

This submodule contains the ExifToolAlpha class, which extends the ExifToolHelper class with experimental functionality.

Note

exiftool.helper.ExifToolAlpha class of this submodule is available in the exiftool namespace as exiftool.ExifToolAlpha

Module Contents

Classes

ExifToolAlpha

This class is for the "experimental" functionality. In the grand scheme of things, this class

Functions

check_ok(result)

Evaluates the output from a exiftool write operation (e.g. set_tags)

format_error(result)

Evaluates the output from a exiftool write operation (e.g. set_tags)

strip_nl(s)

Attributes

KW_TAGNAME

basestring

class exiftool.experimental.ExifToolAlpha(auto_start=True, check_execute=True, check_tag_names=True, **kwargs)

Bases: exiftool.helper.ExifToolHelper

Inheritance diagram of exiftool.experimental.ExifToolAlpha

This class is for the “experimental” functionality. In the grand scheme of things, this class contains “not well tested” functionality, methods that are less used, or methods with niche use cases. In some methods, edge cases on some of these methods may produce unexpected or ambiguous results. However, if there is increased demand, or robustness improves, functionality may merge into exiftool.ExifToolHelper class.

The starting point of this class was to remove all the “less used” functionality that was merged in on some arbitrary pull requests to the original v0.2 PyExifTool repository. This alpha-quality code is brittle and contains a lot of “hacks” for a niche set of use cases. As such, it may be buggy and it shouldn’t crowd the core functionality of the exiftool.ExifTool class or the stable extended functionality of the exiftool.ExifToolHelper class with unneeded bloat.

The class heirarchy: ExifTool -> ExifToolHelper -> ExifToolAlpha

  • ExifTool - stable base class with CORE functionality

  • ExifToolHelper - user friendly class that extends the base class with general functionality not found in the core

  • ExifToolAlpha - alpha-quality code which extends the ExifToolHelper to add functionality that is niche, brittle, or not well tested

Because of this heirarchy, you could always use/extend the exiftool.ExifToolAlpha class to have all functionality, or at your discretion, use one of the more stable classes above.

Please issue PR to this class to add functionality, even if not tested well. This class is for experimental code after all!

Parameters:
  • auto_start (bool) – Will automatically start the exiftool process on first command run, defaults to True

  • check_execute (bool) – Will check the exit status (return code) of all commands. This catches some invalid commands passed to exiftool subprocess, defaults to True. See check_execute for more info.

  • check_tag_names (bool) – Will check the tag names provided to methods which work directly with tag names. This catches unintended uses and bugs, default to True. See check_tag_names for more info.

  • kwargs – All other parameters are passed directly to the super-class constructor: exiftool.ExifTool.__init__()

copy_tags(from_filename, to_filename)

Copy all tags from one file to another.

execute_json_wrapper(filenames, params=None, retry_on_error=True)
get_metadata_batch_wrapper(filenames, params=None)
get_metadata_wrapper(filename, params=None)
get_tag(filename, tag)

Extract a single tag from a single file.

The return value is the value of the specified tag, or None if this tag was not found in the file.

Does existence checks

get_tag_batch(filenames, tag)

Extract a single tag from the given files.

The first argument is a single tag name, as usual in the format <group>:<tag>.

The second argument is an iterable of file names.

The return value is a list of tag values or None for non-existent tags, in the same order as filenames.

get_tag_batch_wrapper(tag, filenames, params=None)
get_tag_wrapper(tag, filename, params=None)
get_tags_batch_wrapper(tags, filenames, params=None)
get_tags_wrapper(tags, filename, params=None)
set_keywords(filename, mode, keywords)

Modifies the keywords tag for the given file.

This is a convenience function derived from set_keywords_batch(). Only difference is that it takes as last argument only one file name as a string.

set_keywords_batch(files, mode, keywords)

Modifies the keywords tag for the given files.

The first argument is the operation mode:

  • KW_REPLACE: Replace (i.e. set) the full keywords tag with keywords.

  • KW_ADD: Add keywords to the keywords tag.

    If a keyword is present, just keep it.

  • KW_REMOVE: Remove keywords from the keywords tag.

    If a keyword wasn’t present, just leave it.

The second argument is an iterable of key words.

The third argument is an iterable of file names.

The format of the return value is the same as for execute().

It can be passed into check_ok() and format_error().

exiftool.experimental.check_ok(result)

Evaluates the output from a exiftool write operation (e.g. set_tags)

The argument is the result from the execute method.

The result is True or False.

exiftool.experimental.format_error(result)

Evaluates the output from a exiftool write operation (e.g. set_tags)

The argument is the result from the execute method.

The result is a human readable one-line string.

exiftool.experimental.strip_nl(s)
exiftool.experimental.KW_TAGNAME = 'IPTC:Keywords'
exiftool.experimental.basestring = ()