Changeset View
Changeset View
Standalone View
Standalone View
src/extractor.cpp
Show All 14 Lines | |||||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * Lesser General Public License for more details. | 16 | * Lesser General Public License for more details. | ||
17 | * | 17 | * | ||
18 | * You should have received a copy of the GNU Lesser General Public | 18 | * You should have received a copy of the GNU Lesser General Public | ||
19 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | 19 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
20 | * | 20 | * | ||
21 | */ | 21 | */ | ||
22 | 22 | | |||
23 | #include "filemetadatautil_p.h" | ||||
24 | | ||||
23 | #include <QCoreApplication> | 25 | #include <QCoreApplication> | ||
24 | #include <QCommandLineParser> | 26 | #include <QCommandLineParser> | ||
25 | #include <QMimeDatabase> | 27 | #include <QMimeDatabase> | ||
26 | #include <QDataStream> | 28 | #include <QDataStream> | ||
27 | #include <QDebug> | 29 | #include <QDebug> | ||
28 | #include <QFile> | 30 | #include <QFile> | ||
29 | 31 | | |||
30 | #include <KFileMetaData/SimpleExtractionResult> | 32 | #include <KFileMetaData/SimpleExtractionResult> | ||
31 | #include <KFileMetaData/ExtractorCollection> | 33 | #include <KFileMetaData/ExtractorCollection> | ||
32 | #include <KFileMetaData/Extractor> | 34 | #include <KFileMetaData/Extractor> | ||
33 | #include <KFileMetaData/PropertyInfo> | | |||
34 | #include <KFileMetaData/MimeUtils> | 35 | #include <KFileMetaData/MimeUtils> | ||
35 | 36 | | |||
36 | #include <iostream> | 37 | #include <iostream> | ||
37 | 38 | | |||
38 | int main(int argc, char **argv) | 39 | int main(int argc, char **argv) | ||
39 | { | 40 | { | ||
40 | QCoreApplication app(argc, argv); | 41 | QCoreApplication app(argc, argv); | ||
41 | 42 | | |||
Show All 16 Lines | |||||
58 | for (KFileMetaData::Extractor *ex : exList) { | 59 | for (KFileMetaData::Extractor *ex : exList) { | ||
59 | ex->extract(&result); | 60 | ex->extract(&result); | ||
60 | } | 61 | } | ||
61 | 62 | | |||
62 | QFile out; | 63 | QFile out; | ||
63 | out.open(stdout, QIODevice::WriteOnly); | 64 | out.open(stdout, QIODevice::WriteOnly); | ||
64 | QDataStream stream(&out); | 65 | QDataStream stream(&out); | ||
65 | 66 | | |||
66 | QVariantMap map; | 67 | QVariantMap map = Baloo::Private::toNamedVariantMap(result.properties()); | ||
67 | QMapIterator<KFileMetaData::Property::Property, QVariant> it(result.properties()); | | |||
68 | while (it.hasNext()) { | | |||
69 | it.next(); | | |||
70 | KFileMetaData::PropertyInfo pi(it.key()); | | |||
71 | map.insertMulti(pi.name(), it.value()); | | |||
72 | } | | |||
73 | 68 | | |||
74 | stream << map; | 69 | stream << map; | ||
75 | 70 | | |||
76 | qDebug() << map; | 71 | qDebug() << map; | ||
77 | 72 | | |||
78 | return 0; | 73 | return 0; | ||
79 | } | 74 | } |