diff --git a/openbr/plugins/misc.cpp b/openbr/plugins/misc.cpp index 765568d..35dd638 100644 --- a/openbr/plugins/misc.cpp +++ b/openbr/plugins/misc.cpp @@ -424,19 +424,21 @@ BR_REGISTER(Transform, SubjectTransform) /*! * \ingroup transforms - * \brief Remove templates with the specified file extension. + * \brief Remove templates with the specified file extension or metadata value. * \author Josh Klontz \cite jklontz */ class RemoveTemplatesTransform : public UntrainableMetaTransform { Q_OBJECT Q_PROPERTY(QString regexp READ get_regexp WRITE set_regexp RESET reset_regexp STORED false) + Q_PROPERTY(QString key READ get_key WRITE set_key RESET reset_key STORED false) BR_PROPERTY(QString, regexp, "") + BR_PROPERTY(QString, key, "") void project(const Template &src, Template &dst) const { const QRegularExpression re(regexp); - const QRegularExpressionMatch match = re.match(src.file.suffix()); + const QRegularExpressionMatch match = re.match(key.isEmpty() ? src.file.suffix() : src.file.get(key)); if (match.hasMatch()) dst = Template(); else dst = src; }