metadata: allow to select which metadata tags to include in the output image

(cherry picked from commit ed64206cb8b4455870815e2c51aecbd5c09e4054)
This commit is contained in:
Alberto Griggio
2020-04-08 11:48:36 -07:00
committed by Lawrence Lee
parent 5fdff8dab4
commit abb052e51b
12 changed files with 347 additions and 67 deletions

View File

@@ -313,6 +313,8 @@ void Exiv2Metadata::remove_unwanted(Exiv2::ExifData &dst) const
for (auto it = dst.begin(); it != dst.end(); ) {
if (badtags.find(it->key()) != badtags.end()) {
it = dst.erase(it);
} else if (exif_keys_ && exif_keys_->find(it->key()) == exif_keys_->end()) {
it = dst.erase(it);
} else {
bool found = false;
for (auto &p : badpatterns) {
@@ -393,6 +395,16 @@ void Exiv2Metadata::saveToXmp(const Glib::ustring &path) const
}
void Exiv2Metadata::setExifKeys(const std::vector<std::string> *keys)
{
exif_keys_.reset();
if (keys) {
exif_keys_ = std::make_shared<std::unordered_set<std::string>>();
exif_keys_->insert(keys->begin(), keys->end());
}
}
Glib::ustring Exiv2Metadata::xmpSidecarPath(const Glib::ustring &path)
{
Glib::ustring fn = path;