diff --git a/openbr/plugins/gallery.cpp b/openbr/plugins/gallery.cpp index a57aae2..8463e77 100644 --- a/openbr/plugins/gallery.cpp +++ b/openbr/plugins/gallery.cpp @@ -974,6 +974,72 @@ class landmarksGallery : public Gallery BR_REGISTER(Gallery, landmarksGallery) +/*! + * \ingroup galleries + * \brief Treats each line as a file. + * \author Josh Klontz \cite jklontz + * + * Columns should be comma separated with first row containing headers. + * The first column in the file should be the path to the file to enroll. + * Other columns will be treated as file metadata. + * + * \see txtGallery + */ +class turkGallery : public Gallery +{ + Q_OBJECT +; + TemplateList readBlock(bool *done) + { + *done = true; + TemplateList templates; + if (!file.exists()) return templates; + + QStringList lines = QtUtils::readLines(file); + QRegExp regexp(",(?!(?:\\w+,?)+\\])"); + + QStringList headers; + + if (!lines.isEmpty()) headers = lines.takeFirst().split(regexp); + + foreach (const QString &line, lines) { + QStringList words = line.split(regexp); + if (words.size() != headers.size()) continue; + File f; + f.name = words[0]; + f.set("Label", words[0].mid(0,5)); + + for (int i=1; i categoryMap; + for (int j=0; j