digiKam Developer Documentation: Digikam::ExifToolParser Class Reference

| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | List of all members
Digikam::ExifToolParser Class Reference
Inheritance diagram for Digikam::ExifToolParser:

## Public Types
typedef QHash< QString, QVariantList > | ExifToolData
| A map used to store ExifTool data shared with ExifToolProcess class:

## Public Slots
void | slotExifToolResult (int cmdId)

## Signals
void | signalExifToolAsyncData (const ExifToolParser::ExifToolData &map)
void | signalExifToolDataAvailable ()

## Public Member Functions
| ExifToolParser (QObject *const parent, bool async=false)
| Constructor, Destructor, and Configuration Accessors. See exiftoolparser.cpp for details.
bool | applyChanges (const QString &path, const ExifToolData &newTags)
| Apply tag changes to a target file using ExifTool with a list of tag properties.
bool | applyChanges (const QString &path, const QString &exvTempFile, bool hasExif=true, bool hasXmp=true, bool hasCSet=false)
| Apply tag changes to a target file using ExifTool with a EXV container.
bool | applyMetadataFile (const QString &path, const QString &meta)
| Apply a file with metadata to the target file.
bool | changeTimestamps (const QString &path, const QDateTime &dateTime)
| Change all timestamps of the target file using ExifTool.
void | cmdCompleted (const ExifToolProcess::Result &result)
| ExifTool Output Management Methods. See exiftoolparser_output.cpp for details.
bool | copyTags (const QString &src, const QString &dst, unsigned char copyOps, unsigned char writeModes=ExifToolProcess::ALL_MODES)
| Copy group of tags from one source file to a destination file, following copy operations defined by 'copyOps'.
ExifToolData | currentData () const
QString | currentErrorString () const
QString | currentPath () const
void | errorOccurred (const ExifToolProcess::Result &result, QProcess::ProcessError error, const QString &description)
bool | exifToolAvailable () const
| Check the ExifTool program availability.
void | finished ()
bool | hasError () const
| Check if ExifTool has reported an error.
bool | load (const QString &path)
| ExifTool Command Methods. See exiftoolparser_command.cpp for details.
bool | loadChunk (const QString &path, bool copyToAll=false, bool dropMakernotes=false)
| Load Exif, Iptc, and Xmp chunk as Exiv2 EXV byte-array from a file.
bool | readableFormats ()
| Return a list of readable file format extensions.
void | setExifToolProgram (const QString &path)
void | setOutputStream (int cmdAction, const QByteArray &cmdOutputChannel, const QByteArray &cmdErrorChannel)
| Unit-test method to check ExifTool stream parsing.
bool | tagsDatabase ()
| Return a list of all tags from ExifTool database.
bool | translateTags (const QString &path, unsigned char transOps)
| Translate group of tags in file.
bool | translationsList ()
| Return a list of available translations.
bool | version ()
| Return the current version of ExifTool.
bool | writableFormats ()
| Return a list of writable file format extensions.

## Static Public Member Functions
static MetaEngine::TagsMap | tagsDbToOrderedMap (const ExifToolData &tagsDb)
| Helper conversion method to translate unordered tags database hash-table to ordered map.

## Member Typedef Documentation

## ◆ ExifToolData

typedef QHash<QString, QVariantList> Digikam::ExifToolParser::ExifToolData

With load() method, the container is used to get a map of ExifTool tag name as key and tags properties as values: key = ExifTool Tag name (QString - ExifTool Group 0.1.2.4.6) See -G Exiftool option (https://exiftool.org/exiftool_pod.html#Input-output-text-formatting). values = ExifTool Tag value (QString). ExifTool Tag type (QString). ExifTool Tag description (QString). ExifTool Tag numerical value (QString) - available if any .

With loadChunk() method, the container is used to get a EXV chunk as value: key = "EXV" (QString). value = the Exiv2 metadata container (QByteArray).

With applyChanges() method, the container is used as argument to store tuple of ExifTool tag name as key and tag value: key = ExifTool tag name (QString). value = ExifTool Tag value (QString).

With readableFormats() method, the container is used to get a list of upper-case file format extensions supported by ExifTool for reading. key = "READ_FORMAT" (QString). value = list of pairs (ext,desc) (QStringList)

With writableFormats() method, the container is used to get a list of upper-case file format extensions supported by ExifTool for writing. key = "WRITE_FORMAT" (QString). value = list of pairs (ext,desc) (QStringList).

With translationsList() method, the container is used to get a list of ExifTool languages available for translations. key = "TRANSLATIONS_LIST" (QString). value = list of languages as strings (aka fr, en, de, es, etc.) (QStringList).

With tagsDatabase() method, the container is used as argument to store tuple of ExifTool tag name as key and tag description: key = ExifTool tag name (QString). values = ExifTool Tag description (QString). ExifTool Tag type (QString). ExifTool Tag writable (QString).

## Member Function Documentation

## ◆ applyChanges() [1/2]

bool Digikam::ExifToolParser::applyChanges | ( | const QString & | path,
|  | const ExifToolData & | newTags
| ) |  |

Tags can already exists in target file or new ones can be created. To remove a tag, pass an empty string as value.

Parameters

  path | is the target files to change.
  newTags | is the list of tag properties.

## ◆ applyChanges() [2/2]

bool Digikam::ExifToolParser::applyChanges | ( | const QString & | path,
|  | const QString & | exvTempFile,
|  | bool | hasExif = `true`,
|  | bool | hasXmp = `true`,
|  | bool | hasCSet = `false`
| ) |  |

Tags can already exists in target file or new ones can be created.

Parameters

  path | is the target files to change.
  exvTempFile | is the list of changes embedded in EXV container.
  hasExif | if the EXV container has Exif metadata restore MarkerNotes.
  hasXmp | if the EXV container has Xmp metadata.
  hasCSet | if the EXV container has characters set information.

## ◆ applyMetadataFile()

bool Digikam::ExifToolParser::applyMetadataFile | ( | const QString & | path,
|  | const QString & | meta
| ) |  |

Parameters

  path | is the target file to change.
  meta | is the metadata file.

## ◆ changeTimestamps()

bool Digikam::ExifToolParser::changeTimestamps | ( | const QString & | path,
|  | const QDateTime & | dateTime
| ) |  |

Parameters

  path | is the target file to change.
  dateTime | is the date/time.

## ◆ copyTags()

bool Digikam::ExifToolParser::copyTags | ( | const QString & | src,
|  | const QString & | dst,
|  | unsigned char | copyOps,
|  | unsigned char | writeModes = `ExifToolProcess::ALL_MODES`
| ) |  |

Parameters

  src | must be a readable file format supported by ExifTool.
  dst | must be a writable file format supported by ExifTool.
  copyOps | is a OR combination of ExifToolProcess::CopyTagsSource values.
  writeModes | is a OR combaniation of ExifToolProcess::WritingTagsMode values.

## ◆ load()

bool Digikam::ExifToolParser::load | ( | const QString & | path | ) |

Load all metadata with ExifTool from a file. Use currentData() to get the ExifTool map.

## ◆ loadChunk()

bool Digikam::ExifToolParser::loadChunk | ( | const QString & | path,
|  | bool | copyToAll = `false`,
|  | bool | dropMakernotes = `false`
| ) |  |

Use currentData() to get the container.

## ◆ readableFormats()

bool Digikam::ExifToolParser::readableFormats | ( |  | ) |

Use currentData() to get the container as QStringList.

## ◆ tagsDatabase()

bool Digikam::ExifToolParser::tagsDatabase | ( |  | ) |

Use currentData() to get the container.

Warning
  : This method get whole ExifTool database in XML format and take age.

## ◆ tagsDbToOrderedMap()

MetaEngine::TagsMap Digikam::ExifToolParser::tagsDbToOrderedMap | ( | const ExifToolData & | tagsDb | ) |
| static

Tag are formatted like this:

EXIF.IFD0.Image.XResolution EXIF.IFD0.Image.YCbCrCoefficients EXIF.IFD0.Image.YCbCrPositioning EXIF.IFD0.Image.YCbCrSubSampling EXIF.IFD0.Image.YClipPathUnits EXIF.IFD0.Image.YPosition EXIF.IFD0.Image.YResolution FITS.FITS.Image.Author FITS.FITS.Image.Background FITS.FITS.Image.CreateDate FITS.FITS.Image.Instrument FITS.FITS.Image.Object FITS.FITS.Image.ObservationDate

## ◆ translateTags()

bool Digikam::ExifToolParser::translateTags | ( | const QString & | path,
|  | unsigned char | transOps
| ) |  |

Parameters

  path | must be a readable file format supported by ExifTool.
  transOps | is a OR combination of ExifToolProcess::TranslateTagsOps values.

## ◆ translationsList()

bool Digikam::ExifToolParser::translationsList | ( |  | ) |

Use currentData() to get the container as QStringList.

## ◆ version()

bool Digikam::ExifToolParser::version | ( |  | ) |

Use currentData() to get the container as QString.

## ◆ writableFormats()

bool Digikam::ExifToolParser::writableFormats | ( |  | ) |

Use currentData() to get the container as QStringList.