exiv2Driver package

config module

class dcc_jp2_converter.modules.exiv2Driver.config.Exiv2Path

Bases: dcc_jp2_converter.modules.abs_driver_config.AbsDriverConfig

static check_bundled()
static check_config()
static check_path()
static driver_name() → str
get_path()
dcc_jp2_converter.modules.exiv2Driver.config.get_exiv2_path()
Attempts to retrieve the location to exiv2 command. If a path is
specified in the settings ini file, that path will be used. Otherwise, the function will search for it on the path.
Returns:Full path to exiv2 command if found.

Exiv2CommandBuilder

class dcc_jp2_converter.Exiv2CommandBuilder(builder: dcc_jp2_converter.modules.exiv2Driver.exiv2CommandBuilders.abs_builder.AbsBuilder, program_path=None) → None

Use this to generate commands for sending to exiv2.

__init__(builder: dcc_jp2_converter.modules.exiv2Driver.exiv2CommandBuilders.abs_builder.AbsBuilder, program_path=None) → None

Configure how the director should configure the builders.

Parameters:
  • builder – Choose which type of command to build.
  • program_path – Override the location of exiv2 utility.
build_command(src: str, arg: str = None) → list

Builds an exiv2 command

Parameters:
  • src – Path to the source file
  • arg – (Optional) Additional argument to the command.
Returns:

Returns a new command in list format.

Examples

Extract metadata:

# Extract all metadata of a tiff file into an XMP sidecar file.

from dcc_jp2_converter import exiv2CommandBuilders
from dcc_jp2_converter import Exiv2CommandBuilder

SOURCE_FILE_NAME = "/Documents/471223_037.tif"

command_builder = Exiv2CommandBuilder(builder=exiv2CommandBuilders.ExtractIPTCCommand())
command_builder.build_command(src=SOURCE_FILE_NAME)


# This returns the following value
# ['/usr/local/bin/exiv2','-eaX', '/Documents/471223_037.tif']

Copy Metadata:

# Copy Metadata from a tiff file to a jpg file

from dcc_jp2_converter import exiv2CommandBuilders
from dcc_jp2_converter import Exiv2CommandBuilder

SOURCE_FILE_NAME = "/Documents/471223_037.tif"
DESTINATION_FILE_NAME = "/Documents/471223_037.jpg"

command_builder = Exiv2CommandBuilder(builder=exiv2CommandBuilders.CopyIPTCCommand())
command_builder.build_command(src=SOURCE_FILE_NAME, arg=DESTINATION_FILE_NAME)

# This returns the following value
['/usr/local/bin/exiv2', '-it', '/Documents/471223_037.tif', '/Documents/471223_037.jpg']