Commit a8daba19 authored by Volker Krause's avatar Volker Krause

Add option to set context date

parent b90a6703
......@@ -103,6 +103,8 @@ int main(int argc, char** argv)
QCommandLineOption capOpt({QStringLiteral("capabilities")}, QStringLiteral("Show available extraction capabilities."));
QCommandLineOption ctxOpt({QStringLiteral("c"), QStringLiteral("context-date")}, QStringLiteral("ISO date/time for when this data has been received."), QStringLiteral("date"));
QCommandLineOption typeOpt({QStringLiteral("t"), QStringLiteral("type")}, QStringLiteral("Type of the input data [mime, pdf, pkpass, ical, html]."), QStringLiteral("type"));
......@@ -125,7 +127,13 @@ int main(int argc, char** argv), QFile::ReadOnly);
auto contextDt = QDateTime::fromString(parser.value(ctxOpt), Qt::ISODate);
if (!contextDt.isValid()) {
contextDt = QDateTime::currentDateTime();
ExtractorEngine engine;
std::unique_ptr<KPkPass::Pass> pass;
std::unique_ptr<HtmlDocument> htmlDoc;
......@@ -164,8 +172,7 @@ int main(int argc, char** argv)
jsonResult = engine.extract();
const auto result = JsonLdDocument::fromJson(jsonResult);
ExtractorPostprocessor postproc;
// TODO extra option to set this, or retrieve from mime message
// postproc.setContextDate(>dateTime());
const auto postProcResult = JsonLdDocument::toJson(postproc.result());
std::cout << QJsonDocument(postProcResult).toJson().constData() << std::endl;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment